]> err.no Git - scalable-opengroupware.org/commitdiff
work on identities
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 21 Jul 2005 14:49:08 +0000 (14:49 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 21 Jul 2005 14:49:08 +0000 (14:49 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@877 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/SoObjects/Mailer/ChangeLog
SOGo/SoObjects/Mailer/GNUmakefile
SOGo/SoObjects/Mailer/SOGoMailAccounts.m
SOGo/SoObjects/Mailer/SOGoMailIdentity.h
SOGo/SoObjects/Mailer/SOGoMailIdentity.m
SOGo/SoObjects/Mailer/SOGoUser+Mail.h [new file with mode: 0644]
SOGo/SoObjects/Mailer/SOGoUser+Mail.m [new file with mode: 0644]
SOGo/SoObjects/Mailer/Version

index efb7ac4684d4ac5a2d54996c13ad4fc5087f63b1..654c8260f0c84f5d15263521485cf0c3d41948d0 100644 (file)
@@ -1,5 +1,13 @@
 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
index 7410462566a599427da2ef1072d3ccfd562845fa..39319f4f08a54e25ab15d153ddfd63f38f2935fe 100644 (file)
@@ -31,6 +31,7 @@ Mailer_OBJC_FILES += \
        SOGoDraftObject.m               \
        \
        SOGoMailIdentity.m              \
+       SOGoUser+Mail.m                 \
 
 Mailer_RESOURCE_FILES += \
        Version         \
index 2f15df22fa1c2ec9ed1c324c951dab0ebd7f9d0c..fa3eab5ab58efb725b7ed196e06f186f28a17073 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include "SOGoMailAccounts.h"
+#include "SOGoUser+Mail.h"
 #include "common.h"
 #include <NGObjWeb/SoObject+SoDAV.h>
 #include <SOGo/WOContext+Agenor.h>
@@ -94,8 +95,20 @@ static NSString *AgenorShareLoginMarker  = @".-.";
 }
 
 - (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 */
index f9df70913c0cb26d428d468f9b8e47b98edce573..c340fdee24df6ae94f025d11f0ba4955c28c6f4c 100644 (file)
       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__ */
index bc3b9f7580bfeb35f09ecc305ca928bb2d09b122..2debef069661b9b338e9a10a76bf3dc551999c29 100644 (file)
 
 @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 */
diff --git a/SOGo/SoObjects/Mailer/SOGoUser+Mail.h b/SOGo/SoObjects/Mailer/SOGoUser+Mail.h
new file mode 100644 (file)
index 0000000..2442f33
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+  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__ */
diff --git a/SOGo/SoObjects/Mailer/SOGoUser+Mail.m b/SOGo/SoObjects/Mailer/SOGoUser+Mail.m
new file mode 100644 (file)
index 0000000..0b5d5e2
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+  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) */
index b22e520a93c709afff53b012ab2f4ad3b06125b7..8a6b1aad7bbb9382f546722f59101ddc43b6c9b9 100644 (file)
@@ -1,6 +1,6 @@
 # Version file
 
-SUBMINOR_VERSION:=118
+SUBMINOR_VERSION:=119
 
 # v0.9.114 requires libNGMime       v4.5.229
 # v0.9.114 requires libNGExtensions v4.5.165