]> err.no Git - scalable-opengroupware.org/commitdiff
more work on Sieve
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Sun, 28 Nov 2004 18:51:41 +0000 (18:51 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Sun, 28 Nov 2004 18:51:41 +0000 (18:51 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@457 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/SoObjects/Sieve/ChangeLog
SOGo/SoObjects/Sieve/SOGoSieveBaseObject.h
SOGo/SoObjects/Sieve/SOGoSieveBaseObject.m
SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.h
SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.m
SOGo/SoObjects/Sieve/Version
SOGo/UI/Mailer/ChangeLog
SOGo/UI/Mailer/UIxFilterList.m

index 8b1647042e0480e5ab7b12d53039460086a7c4f5..cb375fee6fa188b0cc0f309ca5a0047eca15a94a 100644 (file)
@@ -1,3 +1,7 @@
+2004-11-28  Helge Hess  <helge.hess@skyrix.com>
+       
+       * added list capability, does not work with 'dotted' logins? (v0.9.2)
+       
 2004-11-27  Helge Hess  <helge.hess@skyrix.com>
 
        * started Sieve product
index 97761d83be3fdc21c65e2294ebcf056c8e3fbee0..71fbdcf9d6b6b35615a21fdc62e6779bd5078477 100644 (file)
 */
 
 @class NSString, NSArray, NSURL;
-@class NGImap4Client;
+@class NGImap4Client, NGSieveClient;
 @class SOGoMailManager;
 @class SOGoMailAccount;
 
 @interface SOGoSieveBaseObject : SOGoObject
 {
+  NGSieveClient *sieveClient;
 }
 
 /* hierarchy */
 - (NGImap4Client *)imap4Client;
 - (void)flushMailCaches;
 
+/* Sieve */
+
+- (NGSieveClient *)sieveClient;
+
 @end
 
 #endif /* __Sieve_SOGoSieveBaseObject_H__ */
index 80b97ac6c1f8d17ed7ae1e11edcd8f6904310766..091ff77ab11b4af538ef488ec5b633c5a5761383 100644 (file)
 #include <Mailer/SOGoMailManager.h>
 #include <Mailer/SOGoMailAccount.h>
 #include "common.h"
+#include <NGImap4/NGSieveClient.h>
 #include <NGObjWeb/SoObject+SoDAV.h>
 #include <NGObjWeb/SoHTTPAuthenticator.h>
 #include <NGExtensions/NSURL+misc.h>
 
 @implementation SOGoSieveBaseObject
 
+- (void)dealloc {
+  [self->sieveClient release];
+  [super dealloc];
+}
+
 /* hierarchy */
 
 - (SOGoMailAccount *)mailAccountFolder {
 - (void)flushMailCaches {
 }
 
+/* Sieve */
+
+- (NGSieveClient *)sieveClient {
+  id res;
+  
+  if (self->sieveClient != nil)
+    return self->sieveClient;
+  
+  /* check container */
+
+  res = [self container];
+  if ([res respondsToSelector:_cmd]) {
+    if ((res = [res sieveClient]) != nil) {
+      self->sieveClient = [res retain];
+      return self->sieveClient;
+    }
+  }
+  
+  /* create client */
+  
+  self->sieveClient =
+    [[NGSieveClient alloc] initWithHost:[[self imap4URL] host]];
+  if (self->sieveClient == nil)
+    return nil;
+  
+  /* login */
+  
+  res = [self->sieveClient 
+            login:[[self imap4URL] user] 
+            password:[self imap4Password]];
+  
+  if (![[res valueForKey:@"result"] boolValue]) {
+    [self logWithFormat:
+           @"ERROR: could not login '%@'(%@) into Sieve server: %@: %@",
+           [[self imap4URL] user], [self imap4Password],
+           self->sieveClient, res];
+    [self->sieveClient release]; self->sieveClient = nil;
+    return nil;
+  }
+  
+  return self->sieveClient;
+}
+
 /* debugging */
 
 - (NSString *)loggingPrefix {
index 008ec2175551d7db7a661e002dfb55ed6af2ad5e..acaf78fecfb1d9651c76f812210c39012f034496 100644 (file)
   server.
 */
 
+@class NSDictionary;
+
 @interface SOGoSieveScriptsFolder : SOGoSieveBaseObject
 {
+  NSDictionary *listedScripts;
 }
 
 
index 1165641e17b504d2088b04fc2e72e49861abc9c2..c8287516092c010616fe73e7c17b311457ce1a25 100644 (file)
 */
 
 #include "SOGoSieveScriptsFolder.h"
+#include <NGImap4/NGSieveClient.h>
 #include "common.h"
 
 @implementation SOGoSieveScriptsFolder
 
+- (void)dealloc {
+  [self->listedScripts release];
+  [super dealloc];
+}
+
+/* listing */
+
+- (NSDictionary *)fetchScripts {
+  if (self->listedScripts != nil)
+    return self->listedScripts;
+  
+  self->listedScripts = [[[self sieveClient] listScripts] copy];
+  return self->listedScripts;
+}
+
+/* standard methods */
+
+- (NSArray *)toOneRelationshipKeys {
+  return [[self fetchScripts] allKeys];
+}
+
 @end /* SOGoSieveScriptsFolder */
index e2e93a0fb183a6e6b945a4c92535230b3c568871..4ba9ab796af585b2331d4aec58e7d77c370f40f1 100644 (file)
@@ -1,5 +1,5 @@
 # Version file
 
-SUBMINOR_VERSION:=1
+SUBMINOR_VERSION:=2
 
 # v0.9.1 requires libNGMime v4.3.194
index 8a14bd97172ad80ba61de2bef516c3af55fa43e3..1794ae5bef32d6ebd4a21b0fccb3c99488cd0672 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-28  Helge Hess  <helge.hess@skyrix.com>
+
+       * UIxFilterList.m: use toOneRelationshipKeys to retrieve the filters
+         being displayed (v0.9.66)
+
 2004-11-27  Helge Hess  <helge.hess@skyrix.com>
 
        * v0.9.65
index ffea50ab0b3da38aeaf33f56b71e1464d7bf382f..958777b8cf84e9f00e6a8f7c3a264e0fbc0fa527 100644 (file)
 - (id)defaultAction {
   // TODO: remove log
   [self logWithFormat:@"default action ..."];
-
+  
   [self logWithFormat:@"should fetch scripts in: %@", [self clientObject]];
-
+  self->filters = [[[self clientObject] toOneRelationshipKeys] copy];
+  
   return self;
 }