2005-07-21 Helge Hess <helge.hess@opengroupware.org>
+ * v0.9.119
+
+ * SOGoMailAccounts.m: fetch identities from SoUser
+
+ * added SOGoUser+Mail category for mail specific SoUser fields
+
+ * SOGoMailIdentity.m: added ivars/accessors/description
+
* v0.9.118
* SOGoMailAccounts.m: reject access to the folder in case the name of
SOGoDraftObject.m \
\
SOGoMailIdentity.m \
+ SOGoUser+Mail.m \
Mailer_RESOURCE_FILES += \
Version \
*/
#include "SOGoMailAccounts.h"
+#include "SOGoUser+Mail.h"
#include "common.h"
#include <NGObjWeb/SoObject+SoDAV.h>
#include <SOGo/WOContext+Agenor.h>
}
- (NSArray *)fetchAllIdentities {
- [self logWithFormat:@"TODO: implement me: %s", __PRETTY_FUNCTION__];
- return nil;
+ WOContext *ctx;
+
+ if ((ctx = [[WOApplication application] context]) == nil) {
+ [self logWithFormat:@"ERROR(%s): cannot procede without context!",
+ __PRETTY_FUNCTION__];
+ return nil;
+ }
+
+ if ([self isInternetRequest]) { /* only show primary mailbox in Internet */
+ // just return the primary identity
+ return [[ctx activeUser] primaryMailIdentity];
+ }
+
+ return [[ctx activeUser] fetchAllMailIdentitiesWithOnlyEmitterAccess:NO];
}
/* name lookup */
select the quote)
*/
+@class NSString;
+
@interface SOGoMailIdentity : NSObject
{
+ NSString *name;
+ NSString *email;
+ NSString *replyTo;
+ NSString *organization;
+ NSString *signature;
+ NSString *vCard;
+ NSString *sentFolderName;
+ NSString *sentBCC;
+ NSString *draftsFolderName;
+ NSString *templatesFolderName;
+ struct {
+ int composeHTML:1;
+ int reserved:31;
+ } idFlags;
}
+/* accessors */
+
+- (void)setName:(NSString *)_value;
+- (NSString *)name;
+
+- (void)setEmail:(NSString *)_value;
+- (NSString *)email;
+
+- (void)setReplyTo:(NSString *)_value;
+- (NSString *)replyTo;
+
+- (void)setOrganization:(NSString *)_value;
+- (NSString *)organization;
+
+- (void)setSignature:(NSString *)_value;
+- (NSString *)signature;
+- (BOOL)hasSignature;
+
+- (void)setVCard:(NSString *)_value;
+- (NSString *)vCard;
+- (BOOL)hasVCard;
+
+- (void)setSentFolderName:(NSString *)_value;
+- (NSString *)sentFolderName;
+
+- (void)setSentBCC:(NSString *)_value;
+- (NSString *)sentBCC;
+
+- (void)setDraftsFolderName:(NSString *)_value;
+- (NSString *)draftsFolderName;
+
+- (void)setTemplatesFolderName:(NSString *)_value;
+- (NSString *)templatesFolderName;
+
@end
#endif /* __Mailer_SOGoMailIdentity_H__ */
@implementation SOGoMailIdentity
+- (void)dealloc {
+ [self->name release];
+ [self->email release];
+ [self->replyTo release];
+ [self->organization release];
+ [self->signature release];
+ [self->vCard release];
+ [self->sentFolderName release];
+ [self->sentBCC release];
+ [self->draftsFolderName release];
+ [self->templatesFolderName release];
+ [super dealloc];
+}
+
+/* accessors */
+
+- (void)setName:(NSString *)_value {
+ ASSIGNCOPY(self->name, _value);
+}
+- (NSString *)name {
+ return self->name;
+}
+
+- (void)setEmail:(NSString *)_value {
+ ASSIGNCOPY(self->email, _value);
+}
+- (NSString *)email {
+ return self->email;
+}
+
+- (void)setReplyTo:(NSString *)_value {
+ ASSIGNCOPY(self->replyTo, _value);
+}
+- (NSString *)replyTo {
+ return self->replyTo;
+}
+
+- (void)setOrganization:(NSString *)_value {
+ ASSIGNCOPY(self->organization, _value);
+}
+- (NSString *)organization {
+ return self->organization;
+}
+
+- (void)setSignature:(NSString *)_value {
+ ASSIGNCOPY(self->signature, _value);
+}
+- (NSString *)signature {
+ return self->signature;
+}
+- (BOOL)hasSignature {
+ return [[self signature] isNotEmpty];
+}
+
+- (void)setVCard:(NSString *)_value {
+ ASSIGNCOPY(self->vCard, _value);
+}
+- (NSString *)vCard {
+ return self->vCard;
+}
+- (BOOL)hasVCard {
+ return [[self vCard] isNotEmpty];
+}
+
+- (void)setSentFolderName:(NSString *)_value {
+ ASSIGNCOPY(self->sentFolderName, _value);
+}
+- (NSString *)sentFolderName {
+ return self->sentFolderName;
+}
+
+- (void)setSentBCC:(NSString *)_value {
+ ASSIGNCOPY(self->sentBCC, _value);
+}
+- (NSString *)sentBCC {
+ return self->sentBCC;
+}
+
+- (void)setDraftsFolderName:(NSString *)_value {
+ ASSIGNCOPY(self->draftsFolderName, _value);
+}
+- (NSString *)draftsFolderName {
+ return self->draftsFolderName;
+}
+
+- (void)setTemplatesFolderName:(NSString *)_value {
+ ASSIGNCOPY(self->templatesFolderName, _value);
+}
+- (NSString *)templatesFolderName {
+ return self->templatesFolderName;
+}
+
+/* description */
+
+- (NSString *)description {
+ NSMutableString *ms;
+
+ ms = [NSMutableString stringWithCapacity:128];
+ [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])];
+
+ if (self->name != nil) [ms appendFormat:@" name='%@'", self->name];
+ if (self->email != nil) [ms appendFormat:@" email='%@'", self->email];
+
+ if ([self->sentBCC length] > 0) [ms appendString:@" sent-bcc"];
+ if ([self->vCard length] > 0) [ms appendString:@" vcard"];
+
+ [ms appendString:@">"];
+ return ms;
+}
+
@end /* SOGoMailIdentity */
--- /dev/null
+/*
+ Copyright (C) 2005 SKYRIX Software AG
+
+ This file is part of OpenGroupware.org.
+
+ OGo is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with OGo; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#ifndef __Mailer_SOGoUser_Mail_H__
+#define __Mailer_SOGoUser_Mail_H__
+
+#include <SoObjects/Mailer/SOGoMailBaseObject.h>
+
+/*
+ SOGoUser(Mail)
+
+ TODO: document
+
+ This category adds mail related stuff to the SOGo user class.
+*/
+
+#include <SOGo/SOGoUser.h>
+
+@class NSArray;
+@class SOGoMailIdentity;
+
+@interface SOGoUser(Mail)
+
+- (SOGoMailIdentity *)primaryMailIdentity;
+- (NSArray *)fetchAllMailIdentitiesWithOnlyEmitterAccess:(BOOL)_onlyGC;
+
+@end
+
+#endif /* __Mailer_SOGoUser_Mail_H__ */
--- /dev/null
+/*
+ Copyright (C) 2004-2005 SKYRIX Software AG
+
+ This file is part of OpenGroupware.org.
+
+ OGo is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with OGo; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#include "SOGoUser+Mail.h"
+#include "SOGoMailIdentity.h"
+#include "common.h"
+
+@implementation SOGoUser(Mail)
+
+- (SOGoMailIdentity *)primaryMailIdentity {
+ NSString *account;
+
+ account = [self valueForKey:@"primaryIMAP4AccountString"];
+
+#warning IMPLEMENT ME
+ return nil;
+}
+
+- (SOGoMailIdentity *)mailIdentityForAccount:(NSString *)_account
+ emitter:(NSString *)_em
+{
+#warning IMPLEMENT ME
+ return nil;
+}
+
+- (NSArray *)fetchAllMailIdentitiesWithOnlyEmitterAccess:(BOOL)_onlyGC {
+ NSMutableArray *identities;
+ NSEnumerator *accounts;
+ NSDictionary *shares;
+ NSString *account;
+ id identity;
+
+ identity = [self primaryMailIdentity];
+ shares = [self valueForKey:@"additionalIMAP4AccountsAndEMails"];
+ if ([shares count] == 0)
+ return identity;
+
+ identities = [NSMutableArray arrayWithCapacity:[shares count] + 1];
+ if (identity != nil) [identities addObject:identity];
+
+ accounts = [shares keyEnumerator];
+ while ((account = [accounts nextObject]) != nil) {
+ NSString *emitter;
+
+ emitter = [shares objectForKey:account];
+ if (_onlyGC && ![emitter isNotNull]) continue;
+
+ identity = [self mailIdentityForAccount:account emitter:emitter];
+ if (identity != nil)
+ [identities addObject:identity];
+ }
+
+ [self logWithFormat:@"TODO: WORK ON IDENTITIES: %@", shares];
+ return nil;
+}
+
+@end /* SOGoUser(Mail) */
# Version file
-SUBMINOR_VERSION:=118
+SUBMINOR_VERSION:=119
# v0.9.114 requires libNGMime v4.5.229
# v0.9.114 requires libNGExtensions v4.5.165