Created
February 1, 2010 22:56
-
-
Save ccgus/292136 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// LBIMAPTestAppDelegate.m | |
// LBIMAPTest | |
// | |
// Created by August Mueller on 1/29/10. | |
// Copyright 2010 Flying Meat Inc. All rights reserved. | |
// | |
#import "LBIMAPTestAppDelegate.h" | |
#import "IPAddress.h" | |
@implementation LBIMAPTestAppDelegate | |
@synthesize window; | |
- (void)quit { | |
[connection logoutWithBlock:^(BOOL success, NSError *arg2) { | |
if (success) { | |
[connection release]; | |
connection = nil; | |
NSLog(@"ALL DONE"); | |
} | |
else { | |
NSLog(@"LOGOUT WAS BORKED!"); | |
} | |
[NSApp terminate:self]; | |
}]; | |
} | |
- (void)listMailboxes { | |
[connection listSubscribedMailboxesWithBock:^(BOOL success, NSError *arg2) { | |
debug(@"got mailboxes!"); | |
NSArray *theList = [connection fetchedMailboxes]; | |
for (NSDictionary *mailboxInfo in theList) { | |
debug(@"mailboxInfo: %@", mailboxInfo); | |
} | |
[connection selectMailbox:@"INBOX" block:^(BOOL success, NSError *arg2) { | |
debug(@"select worked!"); | |
[self quit]; | |
}]; | |
}]; | |
} | |
-(void)applicationDidFinishLaunching:(NSNotification *)aNotification { | |
// Insert code here to initialize your application | |
IPAddress *addr = [IPAddress addressWithHostname:@"172.16.66.130" port:143]; | |
connection = [[LBIMAPConnection alloc] initToAddress:addr]; | |
[connection setDebugOutput:YES]; | |
[connection connectUsingBlock:^(BOOL arg1, NSError *arg2) { | |
[connection loginWithUsername:@"gus" password:@"password" block:^(BOOL success, NSError *arg2) { | |
if (success) { | |
debug(@"woot!"); | |
[self listMailboxes]; | |
} | |
else { | |
debug(@"well shit."); | |
} | |
}]; | |
}]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment