Dependency Graph
View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001391 | SOGo | SOPE | public | 2011-07-20 20:16 | 2012-11-30 15:26 |
Reporter | mra | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Product Version | 1.3.8 | ||||
Fixed in Version | 2.0.3 | ||||
Summary | 0001391: Patch for retrieving managesieve capabilities | ||||
Description | The managesieve protocol (see RFC) defines that the managesieve server has to tell the client its capabilities directly after the login and before the first commands which will be sent. The attached patch extends the SOPE-NGSieveClient with the ability for retrieving and storing the capabilities for each connection. This could be usefull for the some extensions for SOGoSieveManager. | ||||
Tags | No tags attached. | ||||
2011-07-20 20:16
|
patch_SOPE_sieve_capabilities.diff (3,067 bytes)
# # old_revision [bb2b434f5b8424fa1b0cb475825a0114ca97c65a] # # patch "sope-mime/NGImap4/NGSieveClient.h" # from [bbc18924ea7c26d8d7bb285d54e63cb633ef53f8] # to [1592682df311883a37633c4b4a5e77e6728b6210] # # patch "sope-mime/NGImap4/NGSieveClient.m" # from [71d47d3ed7001a0e2b2f50ad6f71b3bd0c951679] # to [76cf56bdab1cdfb640484189df7519c78dba76ca] # ============================================================ --- sope-mime/NGImap4/NGSieveClient.h bbc18924ea7c26d8d7bb285d54e63cb633ef53f8 +++ sope-mime/NGImap4/NGSieveClient.h 1592682df311883a37633c4b4a5e77e6728b6210 @@ -59,8 +59,12 @@ typedef enum { NSString *authname; NSString *login; - NSString *password; + NSString *password; + NSString *sieveCapabilities; + NSString *sieveServerType; + NSArray *sieveCapabilitiesList; + BOOL debug; } @@ -77,6 +81,7 @@ typedef enum { - (id<NGActiveSocket>)socket; - (id<NGSocketAddress>)address; + /* exceptions */ - (NSException *)lastException; @@ -106,6 +111,14 @@ typedef enum { - (BOOL)isEqualToSieveClient:(NGSieveClient *)_obj; + +/* Misc */ +- (NSString *)getSieveServerType; +- (NSString *)getSieveCapabilities; +- (NSArray *)getSieveCapabilitiesAsArray; +- (BOOL)hasCapability:(NSString *)_capabilityName; + + @end #endif /* __Networking_NGSieve_NGSieveClient_H__ */ ============================================================ --- sope-mime/NGImap4/NGSieveClient.m 71d47d3ed7001a0e2b2f50ad6f71b3bd0c951679 +++ sope-mime/NGImap4/NGSieveClient.m 76cf56bdab1cdfb640484189df7519c78dba76ca @@ -187,6 +187,44 @@ static BOOL debugImap4 = NO; return self->address; } +- (NSString *)getSieveServerType { + if(self->sieveServerType) + return self->sieveServerType; + + return nil; +} + +- (NSString *)getSieveCapabilities { + if(self->sieveCapabilities) + return self->sieveCapabilities; + + return nil; +} + + +- (NSArray *)getSieveCapabilitiesAsArray { + if(self->sieveCapabilitiesList) + return self->sieveCapabilitiesList; + + return nil; +} + +- (BOOL) hasCapability:(NSString *)_capabilityName { + + // Caps available? + if(self->sieveCapabilitiesList) + { + if([self->sieveCapabilitiesList containsObject: _capabilityName]) + { + return YES; + } + } + + // Nothing found + return NO; +} + + /* exceptions */ - (void)setLastException:(NSException *)_ex { @@ -238,8 +276,15 @@ static BOOL debugImap4 = NO; fprintf(stderr, "[%s] <openConnection> : time needed: %4.4fs\n", __PRETTY_FUNCTION__, ti < 0.0 ? -1.0 : ti); } - return [self normalizeOpenConnectionResponse: + + NSDictionary *sieveResult = [self normalizeOpenConnectionResponse: [self->parser parseSieveResponse]]; + + self->sieveCapabilities = [sieveResult objectForKey:@"capabilities"]; + self->sieveCapabilitiesList = [self->sieveCapabilities componentsSeparatedByString: @" "]; // delimiter is always blank + self->sieveServerType = [sieveResult objectForKey:@"server"]; + + return sieveResult; } - (NSNumber *)isConnected { |
"Product Version" should be switched to "Monotone" |
|
This patch is independent usable. |
|
I fixed this: https://github.com/inverse-inc/sope/commit/bc62cc45f0c4978f4454a8ccf0887b1f01f6e32c I didn't use your entire patch because it had memleaks, and a Java-style syntax. Nonetheless, thanks for submitting it! |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2011-07-20 20:16 | mra | New Issue | |
2011-07-20 20:16 | mra | File Added: patch_SOPE_sieve_capabilities.diff | |
2011-07-20 22:10 | mra | Note Added: 0002730 | |
2012-07-11 07:35 | Christian Mack | Relationship added | child of 0001392 |
2012-07-11 08:25 | mra | Note Added: 0004120 | |
2012-11-30 15:26 | ludovic | Note Added: 0005002 | |
2012-11-30 15:26 | ludovic | Status | new => closed |
2012-11-30 15:26 | ludovic | Resolution | open => fixed |
2012-11-30 15:26 | ludovic | Fixed in Version | => 2.0.3 |