2 Copyright (C) 2005 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
23 #include <SOGo/AgenorUserManager.h>
26 @implementation SOGoUser
29 [self->userDefaults release];
31 [self->email release];
37 - (AgenorUserManager *)userManager {
38 static AgenorUserManager *um = nil;
39 if (um == nil) um = [[AgenorUserManager sharedUserManager] retain];
46 if (self->email == nil)
47 self->email = [[[self userManager] getEmailForUID:[self login]] copy];
53 self->cn = [[[self userManager] getCNForUID:[self login]] copy];
57 - (NSString *)primaryIMAP4AccountString {
58 return [[self userManager] getIMAPAccountStringForUID:[self login]];
60 - (NSString *)primaryMailServer {
61 return [[self userManager] getServerForUID:[self login]];
64 - (NSArray *)additionalIMAP4AccountStrings {
65 return [[self userManager]getSharedMailboxAccountStringsForUID:[self login]];
67 - (NSArray *)additionalEMailAddresses {
68 return [[self userManager] getSharedMailboxEMailsForUID:[self login]];
71 - (NSDictionary *)additionalIMAP4AccountsAndEMails {
72 return [[self userManager] getSharedMailboxesAndEMailsForUID:[self login]];
75 - (NSURL *)freeBusyURL {
76 return [[self userManager] getFreeBusyURLForUID:[self login]];
81 - (NSUserDefaults *)userDefaults {
82 if (self->userDefaults == nil) {
84 [[[self userManager] getUserDefaultsForUID:[self login]] retain];
86 return self->userDefaults;
91 // TODO: those methods should check whether the traversal stack in the context
92 // already contains proper folders to improve caching behaviour
94 - (id)homeFolderInContext:(id)_ctx {
95 /* Note: watch out for cyclic references */
96 // TODO: maybe we should add an [activeUser reset] method to SOPE
99 folder = [(WOContext *)_ctx objectForKey:@"ActiveUserHomeFolder"];
101 return [folder isNotNull] ? folder : nil;
103 folder = [[WOApplication application] lookupName:[self login]
104 inContext:_ctx acquire:NO];
105 if ([folder isKindOfClass:[NSException class]])
108 [(WOContext *)_ctx setObject:folder ? folder : [NSNull null]
109 forKey:@"ActiveUserHomeFolder"];
113 - (id)schedulingCalendarInContext:(id)_ctx {
114 /* Note: watch out for cyclic references */
117 folder = [(WOContext *)_ctx objectForKey:@"ActiveUserCalendar"];
119 return [folder isNotNull] ? folder : nil;
121 folder = [self homeFolderInContext:_ctx];
122 if ([folder isKindOfClass:[NSException class]])
125 folder = [folder lookupName:@"Calendar" inContext:_ctx acquire:NO];
126 if ([folder isKindOfClass:[NSException class]])
129 [(WOContext *)_ctx setObject:folder ? folder : [NSNull null]
130 forKey:@"ActiveUserCalendar"];