Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added way to git a list of the capabilities from the server

  • Loading branch information...
commit e67020cc1078dc86675b163b6db5adf419549342 1 parent 4dd4759
@mronge mronge authored
Showing with 37 additions and 0 deletions.
  1. +2 −0  Source/CTCoreAccount.h
  2. +35 −0 Source/CTCoreAccount.m
View
2  Source/CTCoreAccount.h
@@ -108,6 +108,8 @@
- (CTIdleResult)idle;
- (void)cancelIdle;
+- (NSSet *)capabilities;
+
@property BOOL idling;
View
35 Source/CTCoreAccount.m
@@ -190,6 +190,41 @@ - (void)cancelIdle {
}
}
+- (NSSet *)capabilities {
+ NSMutableSet *capabilitiesSet = [NSMutableSet set];
+
+ int r;
+ struct mailimap_capability_data *capabilities;
+
+ r = mailimap_capability(self.session, &capabilities);
+ if (r != MAILIMAP_NO_ERROR) {
+ self.lastError = MailCoreCreateErrorFromIMAPCode(r);
+ return nil;
+ }
+
+ for(clistiter * cur = clist_begin(capabilities->cap_list); cur != NULL ; cur = cur->next) {
+ struct mailimap_capability *capability;
+ NSString *name;
+
+ capability = clist_content(cur);
+ name = nil;
+ switch (capability->cap_type) {
+ case MAILIMAP_CAPABILITY_AUTH_TYPE:
+ name = [@"AUTH=" stringByAppendingString:[NSString stringWithUTF8String:capability->cap_data.cap_auth_type]];
+ break;
+ case MAILIMAP_CAPABILITY_NAME:
+ name = [NSString stringWithUTF8String:capability->cap_data.cap_name];
+ break;
+ }
+ if (name != nil) {
+ [capabilitiesSet addObject:name];
+ }
+ }
+ mailimap_capability_data_free(capabilities);
+
+ return capabilitiesSet;
+}
+
- (void)disconnect {
if (connected) {
connected = NO;
Please sign in to comment.
Something went wrong with that request. Please try again.