2 Copyright (C) 2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #include "SOGoMailConnectionEntry.h"
25 @implementation SOGoMailConnectionEntry
27 - (id)initWithClient:(NGImap4Client *)_client password:(NSString *)_pwd {
28 if (_client == nil || _pwd == nil) {
33 if ((self = [super init])) {
34 self->client = [_client retain];
35 self->password = [_pwd copy];
37 self->creationTime = [[NSDate alloc] init];
42 return [self initWithClient:nil password:nil];
46 [self->urlToRights release];
47 [self->cachedUIDs release];
48 [self->uidFolderURL release];
49 [self->uidSortOrdering release];
50 [self->creationTime release];
51 [self->subfolders release];
52 [self->password release];
53 [self->client release];
59 - (NGImap4Client *)client {
62 - (BOOL)isValidPassword:(NSString *)_pwd {
63 return [self->password isEqualToString:_pwd];
66 - (NSDate *)creationTime {
67 return self->creationTime;
70 - (void)cacheHierarchyResults:(NSDictionary *)_hierarchy {
71 ASSIGNCOPY(self->subfolders, _hierarchy);
73 - (NSDictionary *)cachedHierarchyResults {
74 return self->subfolders;
76 - (void)flushFolderHierarchyCache {
77 [self->subfolders release]; self->subfolders = nil;
78 [self->urlToRights release]; self->urlToRights = nil;
83 - (NSString *)cachedMyRightsForURL:(NSURL *)_url {
84 return (_url != nil) ? [self->urlToRights objectForKey:_url] : nil;
86 - (void)cacheMyRights:(NSString *)_rights forURL:(NSURL *)_url {
87 if (self->urlToRights == nil)
88 self->urlToRights = [[NSMutableDictionary alloc] initWithCapacity:8];
89 [self->urlToRights setObject:_rights forKey:_url];
94 - (id)cachedUIDsForURL:(NSURL *)_url qualifier:(id)_q sortOrdering:(id)_so {
97 if (![_so isEqual:self->uidSortOrdering])
99 if (![self->uidFolderURL isEqual:_url])
102 return self->cachedUIDs;
105 - (void)cacheUIDs:(NSArray *)_uids forURL:(NSURL *)_url
106 qualifier:(id)_q sortOrdering:(id)_so
111 ASSIGNCOPY(self->uidSortOrdering, _so);
112 ASSIGNCOPY(self->uidFolderURL, _url);
113 ASSIGNCOPY(self->cachedUIDs, _uids);
116 - (void)flushMailCaches {
117 ASSIGN(self->uidSortOrdering, nil);
118 ASSIGN(self->uidFolderURL, nil);
119 ASSIGN(self->cachedUIDs, nil);
122 @end /* SOGoMailConnectionEntry */