merge of '15825926d3d6130838a6e8a925fb390321c6e5fa'

and '7f4c04f0c1883efb437cd0189f442b20c0063c82'

Monotone-Parent: 15825926d3d6130838a6e8a925fb390321c6e5fa
Monotone-Parent: 7f4c04f0c1883efb437cd0189f442b20c0063c82
Monotone-Revision: 5066f4418986dc6df8b207002b41f82bc9e2bb8b

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-02-20T19:48:50
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2012-02-20 19:48:50 +00:00
commit cb6a4530e1
12 changed files with 127 additions and 31 deletions

View File

@ -3,6 +3,24 @@
* UI/WebServerResources/UIxMailEditor.js (onWindowResize): we now
make use of the ckeditor javascript api to reszie the container.
2012-02-20 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreGCSFolder.m (-setDisplayName:): new method
that intercept the setting of PR_DISPLAY_NAME_UNICODE following
the mechanism described below.
(-getPrDisplayName:inMemCtx): overriden method.
* OpenChange/MAPIStoreGCSBaseContext.m (+folderNameSuffix): new
method that returns an optional suffix to differentiate between
SOGo folders that are common to multiple Outlook folders, in
particular for Calendar and Tasks folder.
(+getFolderDisplayName:): new utility method that returns a
display name with the above suffix added properly.
* OpenChange/MAPIStoreObject.m (-setMAPIRetainCount)
(-retainCount): removed accessors as well as the corresponding
"mapiRetainCount" ivar as this was part of an unused feature.
2012-02-16 Francis Lachapelle <flachapelle@inverse.ca>
* UI/WebServerResources/UIxAttendeesEditor.js (checkAttendee):

View File

@ -56,4 +56,9 @@ static Class MAPIStoreCalendarFolderK;
return MAPIStoreCalendarFolderK;
}
+ (NSString *) folderNameSuffix
{
return @"c";
}
@end

View File

@ -29,6 +29,9 @@
@interface MAPIStoreGCSBaseContext : MAPIStoreContext
+ (NSString *) folderNameSuffix;
+ (NSString *) getFolderDisplayName: (NSString *) sogoDisplayName;
@end
#endif /* MAPISTOREGCSBASECONTEXT_H */

View File

@ -43,12 +43,31 @@
return nil;
}
+ (NSString *) folderNameSuffix
{
return @"";
}
+ (NSString *) getFolderDisplayName: (NSString *) sogoDisplayName
{
NSString *suffix, *displayName;
suffix = [self folderNameSuffix];
if ([suffix length] > 0 && ![sogoDisplayName hasSuffix: suffix])
displayName = [NSString stringWithFormat: @"%@ (%@)",
sogoDisplayName, suffix];
else
displayName = sogoDisplayName;
return displayName;
}
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
withTDBIndexing: (struct tdb_wrap *) indexingTdb
inMemCtx: (TALLOC_CTX *) memCtx
{
struct mapistore_contexts_list *firstContext = NULL, *context;
NSString *moduleName, *baseUrl, *url, *nameInContainer;
NSString *moduleName, *baseUrl, *url, *nameInContainer, *displayName;
NSArray *subfolders;
MAPIStoreUserContext *userContext;
SOGoParentFolder *parentFolder;
@ -75,8 +94,8 @@
nameInContainer = [currentFolder nameInContainer];
url = [NSString stringWithFormat: @"%@%@", baseUrl, nameInContainer];
context->url = [url asUnicodeInMemCtx: context];
context->name = [[currentFolder displayName]
asUnicodeInMemCtx: context];
displayName = [self getFolderDisplayName: [currentFolder displayName]];
context->name = [displayName asUnicodeInMemCtx: context];
context->main_folder = [nameInContainer isEqualToString: @"personal"];
context->role = [self MAPIContextRole];
context->tag = "tag";

View File

@ -34,7 +34,7 @@
#import <SOGo/SOGoPermissions.h>
#import <SOGo/SOGoUser.h>
#import "MAPIStoreContext.h"
#import "MAPIStoreGCSBaseContext.h"
#import "MAPIStoreTypes.h"
#import "MAPIStoreUserContext.h"
#import "NSData+MAPIStore.h"
@ -102,6 +102,44 @@
return (rc == MAPISTORE_SUCCESS) ? [super deleteFolder] : rc;
}
- (void) setDisplayName: (NSString *) newDisplayName
{
NSString *suffix, *fullSuffix;
Class cClass;
cClass = [(MAPIStoreGCSBaseContext *) [self context] class];
/* if a suffix exists, we strip it from the final name */
suffix = [cClass folderNameSuffix];
if ([suffix length] > 0)
{
fullSuffix = [NSString stringWithFormat: @"(%@)", suffix];
if ([newDisplayName hasSuffix: fullSuffix])
{
newDisplayName = [newDisplayName substringToIndex:
[newDisplayName length]
- [fullSuffix length]];
newDisplayName = [newDisplayName stringByTrimmingSpaces];
}
}
if (![[sogoObject displayName] isEqualToString: newDisplayName])
[sogoObject renameTo: newDisplayName];
}
- (int) getPrDisplayName: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx
{
NSString *displayName;
Class cClass;
cClass = [(MAPIStoreGCSBaseContext *) [self context] class];
displayName = [cClass getFolderDisplayName: [sogoObject displayName]];
*data = [displayName asUnicodeInMemCtx: memCtx];
return MAPISTORE_SUCCESS;
}
- (void) addProperties: (NSDictionary *) newProperties
{
NSString *newDisplayName;
@ -112,7 +150,7 @@
newDisplayName = [newProperties objectForKey: key];
if (newDisplayName)
{
[sogoObject renameTo: newDisplayName];
[self setDisplayName: newDisplayName];
propsCopy = [newProperties mutableCopy];
[propsCopy removeObjectForKey: key];
[propsCopy autorelease];

View File

@ -38,13 +38,14 @@
#undef DEBUG
#include <mapistore/mapistore.h>
static Class MAPIStoreMailFolderK;
static Class MAPIStoreMailFolderK, MAPIStoreOutboxFolderK;
@implementation MAPIStoreMailContext
+ (void) initialize
{
MAPIStoreMailFolderK = [MAPIStoreMailFolder class];
MAPIStoreOutboxFolderK = [MAPIStoreOutboxFolder class];
}
+ (NSString *) MAPIModuleName
@ -208,4 +209,9 @@ static Class MAPIStoreMailFolderK;
return context;
}
- (Class) MAPIStoreFolderClass
{
return MAPIStoreOutboxFolderK;
}
@end

View File

@ -53,4 +53,9 @@
@end
/* MAPIStoreOutboxFolder is a special subclass of MAPIStoreMailFolder where
the displayname is always "Outbox" and can not be changed. */
@interface MAPIStoreOutboxFolder : MAPIStoreMailFolder
@end
#endif /* MAPISTOREMAILFOLDER_H */

View File

@ -61,7 +61,7 @@
#import "MAPIStoreMailFolder.h"
static Class SOGoMailFolderK;
static Class SOGoMailFolderK, MAPIStoreOutboxFolderK;
#undef DEBUG
#include <util/attr.h>
@ -74,6 +74,7 @@ static Class SOGoMailFolderK;
+ (void) initialize
{
SOGoMailFolderK = [SOGoMailFolder class];
MAPIStoreOutboxFolderK = [MAPIStoreOutboxFolder class];
[MAPIStoreAppointmentWrapper class];
}
@ -113,7 +114,10 @@ static Class SOGoMailFolderK;
key = MAPIPropertyKey (PR_DISPLAY_NAME_UNICODE);
newDisplayName = [newProperties objectForKey: key];
if (newDisplayName)
if (newDisplayName
&& ![self isKindOfClass: MAPIStoreOutboxFolderK]
&& ![[(SOGoMailFolder *) sogoObject displayName]
isEqualToString: newDisplayName])
{
[(SOGoMailFolder *) sogoObject renameTo: newDisplayName];
propsCopy = [newProperties mutableCopy];
@ -1078,3 +1082,15 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
}
@end
@implementation MAPIStoreOutboxFolder
- (int) getPrDisplayName: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx
{
*data = [@"Outbox" asUnicodeInMemCtx: memCtx];
return MAPISTORE_SUCCESS;
}
@end

View File

@ -45,8 +45,6 @@
{
const IMP *classGetters;
uint32_t mapiRetainCount;
NSMutableArray *parentContainersBag;
MAPIStoreObject *container;
id sogoObject;
@ -62,10 +60,6 @@
- (id) initWithSOGoObject: (id) newSOGoObject
inContainer: (MAPIStoreObject *) newFolder;
/* HACK: MAPI retain count */
- (void) setMAPIRetainCount: (uint32_t) newCount;
- (uint32_t) mapiRetainCount;
- (void) setIsNew: (BOOL) newIsNew;
- (BOOL) isNew;

View File

@ -100,7 +100,6 @@ static Class NSExceptionK, MAPIStoreFolderK;
{
if ((self = [super init]))
{
mapiRetainCount = 0;
classGetters = (IMP *) MAPIStorePropertyGettersForClass (isa);
parentContainersBag = [NSMutableArray new];
container = nil;
@ -136,16 +135,6 @@ static Class NSExceptionK, MAPIStoreFolderK;
[super dealloc];
}
- (void) setMAPIRetainCount: (uint32_t) newCount
{
mapiRetainCount = newCount;
}
- (uint32_t) mapiRetainCount
{
return mapiRetainCount;
}
- (void) setIsNew: (BOOL) newIsNew
{
isNew = newIsNew;

View File

@ -55,4 +55,9 @@ static Class MAPIStoreTasksFolderK;
return MAPIStoreTasksFolderK;
}
+ (NSString *) folderNameSuffix
{
return @"t";
}
@end

View File

@ -66,7 +66,7 @@ class HTTPUnparsedURL:
class WebDAVClient:
user_agent = "Mozilla/5.0"
def __init__(self, hostname, port, username = None, password = None,
def __init__(self, hostname, port, username = None, password = "",
forcessl = False):
if int(port) == 443 or forcessl:
import M2Crypto.httpslib
@ -75,13 +75,11 @@ class WebDAVClient:
else:
self.conn = httplib.HTTPConnection(hostname, port, True)
if username is not None:
if password is None:
password = ""
if username is None:
self.simpleauth_hash = None
else:
self.simpleauth_hash = (("%s:%s" % (username, password))
.encode('base64')[:-1])
else:
self.simpleauth_hash = None
def prepare_headers(self, query, body):
headers = { "User-Agent": self.user_agent }