Skip to content
Permalink
Browse files

Release 0.9.4 commit

commit 1de2857e59d58372d1f4163fc7dd9a9970f1305c
Author: Joe Keenan <joe@flyingdiver.com>
Date:   Wed Sep 4 23:35:05 2013 -0400

    0.9.4 Fixes

    Fixed problems with multiple SMTP accounts in keychain.
    Added dev profile and code sign app
    Removed startup email check - crashes without email setup
  • Loading branch information...
FlyingDiver committed Sep 4, 2013
1 parent 609961f commit 9e77ed099b04709617ce455fee5dc871ffd5327e
@@ -14,6 +14,7 @@

- (void) sendEmailMessage:(NSString *)message to: (NSString *) recipient;
- (void) validateSMTPWithCompletionHandler:(void (^)(BOOL))handler;
- (BOOL) findProviderForEmail: (NSString *) emailAddress;

//@property (copy) void (^validateSMTPCompletionBlock)(BOOL);

@@ -19,11 +19,9 @@ - (void)sendEmailMessage:(NSString *) messageBody to: (NSString *) recipient
smtpSession.hostname = [[NSUserDefaults standardUserDefaults] stringForKey: kSMTPServerKey];
smtpSession.port = [[NSUserDefaults standardUserDefaults] integerForKey: kSMTPPortKey];
smtpSession.connectionType = [[NSUserDefaults standardUserDefaults] integerForKey: kConnectionTypeKey];
smtpSession.authType =[[NSUserDefaults standardUserDefaults] integerForKey: kAuthTypeKey];

NSArray *smtpAccounts = [SSKeychain accountsForService: kStokerSMTPLogin];
smtpSession.username = [[smtpAccounts objectAtIndex: 0] objectForKey: @"acct"];
smtpSession.password = [SSKeychain passwordForService: kStokerSMTPLogin account: smtpSession.username];
smtpSession.authType =[[NSUserDefaults standardUserDefaults] integerForKey: kAuthTypeKey];
smtpSession.username = [SSKeychain passwordForService: kStokerSMTPService account: kStokerSMTPLogin];
smtpSession.password = [SSKeychain passwordForService: kStokerSMTPService account: kStokerSMTPPassword];

MCOMessageBuilder * builder = [[MCOMessageBuilder alloc] init];

@@ -53,20 +51,45 @@ - (void) validateSMTPWithCompletionHandler:(void (^)(BOOL))handler
smtpSession.port = [[NSUserDefaults standardUserDefaults] integerForKey: kSMTPPortKey];
smtpSession.connectionType = [[NSUserDefaults standardUserDefaults] integerForKey: kConnectionTypeKey];
smtpSession.authType =[[NSUserDefaults standardUserDefaults] integerForKey: kAuthTypeKey];
smtpSession.username = [SSKeychain passwordForService: kStokerSMTPService account: kStokerSMTPLogin];
smtpSession.password = [SSKeychain passwordForService: kStokerSMTPService account: kStokerSMTPPassword];


NSArray *smtpAccounts = [SSKeychain accountsForService: kStokerSMTPLogin];
smtpSession.username = [[smtpAccounts objectAtIndex: 0] objectForKey: @"acct"];
smtpSession.password = [SSKeychain passwordForService: kStokerSMTPLogin account: smtpSession.username];

MCOSMTPOperation *checkOperation = [smtpSession checkAccountOperationWithFrom: [MCOAddress addressWithMailbox: @"joe@flyingdiver.com"]];
NSString *checkEmail = [[NSUserDefaults standardUserDefaults] stringForKey: kEmailAddressKey];
MCOSMTPOperation *checkOperation = [smtpSession checkAccountOperationWithFrom: [MCOAddress addressWithMailbox: checkEmail]];
[checkOperation start:^(NSError *error)
{
if(error)
{
NSLog(@"SMTP check error = %@", error);
handler(FALSE);
}
else
{
handler(TRUE);
}
}];
}

- (BOOL) findProviderForEmail: (NSString *) emailAddress
{
MCOMailProvidersManager *providerManager = [MCOMailProvidersManager sharedManager];

MCOMailProvider *provider = [providerManager providerForEmail: emailAddress];
if (!provider)
{
NSLog(@"No Email Provider found for %@", emailAddress);
return false;
}

NSLog(@"Email Providers found for %@:", emailAddress);
NSArray *providers = [provider smtpServices];
for (MCONetService *i in providers)
{
NSLog(@"\tHostname = %@, port = %d, connectionType = %u, hostnameWithEmail = %@",
i.hostname, i.port, i.connectionType, [i hostnameWithEmail: emailAddress]);
}
return true;
}

@end
@@ -305,7 +305,7 @@
<string key="NSFrame">{{301, 457}, {137, 18}}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="276956840"/>
<reference key="NSNextKeyView" ref="400725338"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="829586413">
<int key="NSCellFlags">67108864</int>
@@ -469,6 +469,7 @@
<string key="NSFrame">{{301, 41}, {146, 18}}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:239</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="428626456">
@@ -601,7 +602,7 @@
<string key="NSFrame">{{119, 280}, {200, 22}}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="112428285"/>
<reference key="NSNextKeyView" ref="1009674781"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="260827325">
@@ -623,7 +624,7 @@
<string key="NSFrame">{{119, 247}, {200, 22}}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="50228102"/>
<reference key="NSNextKeyView" ref="152983866"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="373160001">
@@ -688,7 +689,7 @@
<string key="NSFrame">{{147, 210}, {175, 26}}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="152983866"/>
<reference key="NSNextKeyView" ref="50228102"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="482492606">
@@ -703,17 +704,17 @@
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
<object class="NSMenuItem" key="NSMenuItem" id="395087513">
<object class="NSMenuItem" key="NSMenuItem" id="12304242">
<reference key="NSMenu" ref="330708971"/>
<string key="NSTitle">SSL</string>
<string key="NSTitle">SSL/TLS</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<int key="NSState">1</int>
<reference key="NSOnImage" ref="371254839"/>
<reference key="NSMixedImage" ref="805502883"/>
<string key="NSAction">_popUpItemAction:</string>
<int key="NSTag">2</int>
<int key="NSTag">4</int>
<reference key="NSTarget" ref="482492606"/>
</object>
<bool key="NSMenuItemRespectAlignment">YES</bool>
@@ -732,23 +733,23 @@
<int key="NSTag">1</int>
<reference key="NSTarget" ref="482492606"/>
</object>
<reference ref="395087513"/>
<object class="NSMenuItem" id="12304242">
<object class="NSMenuItem" id="395087513">
<reference key="NSMenu" ref="330708971"/>
<string key="NSTitle">SSL/TLS</string>
<string key="NSTitle">SSL</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="371254839"/>
<reference key="NSMixedImage" ref="805502883"/>
<string key="NSAction">_popUpItemAction:</string>
<int key="NSTag">4</int>
<int key="NSTag">2</int>
<reference key="NSTarget" ref="482492606"/>
</object>
<reference ref="12304242"/>
</array>
<reference key="NSMenuFont" ref="73755225"/>
</object>
<int key="NSSelectedIndex">1</int>
<int key="NSSelectedIndex">2</int>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
<bool key="NSAltersState">YES</bool>
@@ -780,7 +781,7 @@
<object class="NSPopUpButton" id="147051227">
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{147, 174}, {175, 26}}</string>
<string key="NSFrame">{{147, 174}, {199, 26}}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="284584696"/>
@@ -800,7 +801,7 @@
<int key="NSPeriodicInterval">75</int>
<object class="NSMenuItem" key="NSMenuItem" id="1016611034">
<reference key="NSMenu" ref="422021560"/>
<string key="NSTitle">Plain</string>
<string key="NSTitle">Password</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -826,9 +827,10 @@
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="324866748"/>
</object>
<reference ref="1016611034"/>
<object class="NSMenuItem" id="508457873">
<reference key="NSMenu" ref="422021560"/>
<string key="NSTitle">CRAM-MD5</string>
<string key="NSTitle">MD5 Challenge Response</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -838,11 +840,10 @@
<int key="NSTag">1</int>
<reference key="NSTarget" ref="324866748"/>
</object>
<reference ref="1016611034"/>
</array>
<reference key="NSMenuFont" ref="73755225"/>
</object>
<int key="NSSelectedIndex">2</int>
<int key="NSSelectedIndex">1</int>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
<bool key="NSAltersState">YES</bool>
@@ -853,10 +854,10 @@
<object class="NSButton" id="50228102">
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{357, 170}, {111, 32}}</string>
<string key="NSFrame">{{387, 172}, {111, 32}}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="294645908"/>
<reference key="NSNextKeyView" ref="860598612"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="238015092">
@@ -878,10 +879,10 @@
<object class="NSProgressIndicator" id="152983866">
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{404, 218}, {16, 16}}</string>
<string key="NSFrame">{{404, 232}, {16, 16}}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="860598612"/>
<reference key="NSNextKeyView" ref="294645908"/>
<string key="NSReuseIdentifierKey">_NS:945</string>
<int key="NSpiFlags">28938</int>
<double key="NSMaxValue">100</double>
@@ -963,11 +964,12 @@
<string key="NSFrame">{{428, 452}, {25, 25}}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="276956840"/>
<string key="NSReuseIdentifierKey">_NS:1598</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="286975011">
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<int key="NSCellFlags2">167772160</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="73755225"/>
<string key="NSCellIdentifier">_NS:1598</string>
@@ -987,11 +989,12 @@
<string key="NSFrame">{{400, 268}, {25, 25}}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="112428285"/>
<string key="NSReuseIdentifierKey">_NS:1598</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="200522576">
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<int key="NSCellFlags2">167772160</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="73755225"/>
<string key="NSCellIdentifier">_NS:1598</string>
@@ -1388,8 +1391,8 @@
<reference ref="568780687"/>
<reference ref="400725338"/>
<reference ref="1009674781"/>
<reference ref="152983866"/>
<reference ref="50228102"/>
<reference ref="152983866"/>
</array>
<reference key="parent" ref="1005"/>
</object>
@@ -24,7 +24,9 @@ extern NSString * const kSMTPServerKey;
extern NSString * const kSMTPPortKey;
extern NSString * const kConnectionTypeKey;
extern NSString * const kAuthTypeKey;
extern NSString * const kStokerSMTPService;
extern NSString * const kStokerSMTPLogin;
extern NSString * const kStokerSMTPPassword;

@interface PreferencesController : NSWindowController
{
@@ -17,13 +17,15 @@
NSString * const kSendTweetsKey = @"SendTweets";
NSString * const kSendPushMessagesKey = @"SendPushMessages";

NSString * const kEmailAddressKey = @"EmailAddress";
NSString * const kSMTPServerKey = @"SMTPServer";
NSString * const kSMTPPortKey = @"SMTPPort";
NSString * const kConnectionTypeKey = @"SMTPConnectionType";
NSString * const kAuthTypeKey = @"SMTPAuthType";
NSString * const kEmailAddressKey = @"EmailAddress";
NSString * const kSMTPServerKey = @"SMTPServer";
NSString * const kSMTPPortKey = @"SMTPPort";
NSString * const kConnectionTypeKey = @"SMTPConnectionType";
NSString * const kAuthTypeKey = @"SMTPAuthType";

NSString * const kStokerSMTPLogin = @"StokerX: SMTP";
NSString * const kStokerSMTPService = @"StokerX: SMTP";
NSString * const kStokerSMTPLogin = @"SMTPLogin";
NSString * const kStokerSMTPPassword = @"SMTPPassword";


#define MIN_TEMP_AXIS 0.0
@@ -112,16 +114,17 @@ - (IBAction) validateSMTP:(id)sender
[[NSUserDefaults standardUserDefaults] setObject: [self.smtpPort stringValue]
forKey: kSMTPPortKey];

[[NSUserDefaults standardUserDefaults] setInteger: [self.connectionType indexOfSelectedItem]
[[NSUserDefaults standardUserDefaults] setInteger: [[self.connectionType selectedItem] tag]
forKey: kConnectionTypeKey];

[[NSUserDefaults standardUserDefaults] setInteger: [self.authType indexOfSelectedItem]
[[NSUserDefaults standardUserDefaults] setInteger: [[self.authType selectedItem] tag]
forKey: kAuthTypeKey];

[SSKeychain setPassword: [self.smtpPassword stringValue]
forService: kStokerSMTPLogin
account: [self.smtpUsername stringValue]];

[SSKeychain deletePasswordForService: kStokerSMTPService account: kStokerSMTPLogin];
[SSKeychain deletePasswordForService: kStokerSMTPService account: kStokerSMTPPassword];
[SSKeychain setPassword: [self.smtpUsername stringValue] forService: kStokerSMTPService account: kStokerSMTPLogin];
[SSKeychain setPassword: [self.smtpPassword stringValue] forService: kStokerSMTPService account: kStokerSMTPPassword];

[self.busyIndicator startAnimation: self];
[self.validateButton setEnabled: NO];

@@ -139,7 +142,6 @@ - (IBAction) validateSMTP:(id)sender
[self.busyIndicator stopAnimation: self];
[self.validateButton setEnabled: YES];
[self.messageField setStringValue: @"SMTP settings validation successful - Saved!"];
NSLog(@"PreferencesController: SMTP parameters validated");
}
[smtpTest release];
}];
@@ -168,6 +170,7 @@ - (void)windowDidLoad

if ([[NSUserDefaults standardUserDefaults] stringForKey: kMaxGraphTempKey])
[maxGraphTemp setStringValue:[[NSUserDefaults standardUserDefaults] stringForKey: kMaxGraphTempKey]];

// build list of template files for selection pop-up

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
@@ -197,28 +200,41 @@ - (void)windowDidLoad
[self.smtpServer setStringValue: [[NSUserDefaults standardUserDefaults] stringForKey: kSMTPServerKey]];

if ([[NSUserDefaults standardUserDefaults] stringForKey: kSMTPPortKey])
[self.smtpPort setIntegerValue: [[NSUserDefaults standardUserDefaults] integerForKey: kSMTPPortKey]];
[self.smtpPort setStringValue: [[NSUserDefaults standardUserDefaults] stringForKey: kSMTPPortKey]];


if ([[NSUserDefaults standardUserDefaults] stringForKey: kAuthTypeKey])
[self.authType selectItemAtIndex: [[NSUserDefaults standardUserDefaults] integerForKey: kAuthTypeKey]];
[self.authType selectItemWithTag: [[NSUserDefaults standardUserDefaults] integerForKey: kAuthTypeKey]];

if ([[NSUserDefaults standardUserDefaults] stringForKey: kConnectionTypeKey])
[self.connectionType selectItemAtIndex: [[NSUserDefaults standardUserDefaults] integerForKey: kConnectionTypeKey]];
[self.connectionType selectItemWithTag: [[NSUserDefaults standardUserDefaults] integerForKey: kConnectionTypeKey]];

NSArray *smtpAccounts = [SSKeychain accountsForService: kStokerSMTPLogin];
if ([smtpAccounts count] > 0)
{
NSString *userAccount = [[smtpAccounts objectAtIndex: 0] objectForKey: @"acct"];
[self.smtpUsername setStringValue: userAccount];
[self.smtpPassword setStringValue: [SSKeychain passwordForService: kStokerSMTPLogin account: userAccount]];
}
if ([SSKeychain passwordForService: kStokerSMTPService account: kStokerSMTPLogin])
[self.smtpUsername setStringValue: [SSKeychain passwordForService: kStokerSMTPService account: kStokerSMTPLogin]];

if ([SSKeychain passwordForService: kStokerSMTPService account: kStokerSMTPPassword])
[self.smtpPassword setStringValue: [SSKeychain passwordForService: kStokerSMTPService account: kStokerSMTPPassword]];

[[NSUserDefaults standardUserDefaults] addObserver: self
forKeyPath: kEmailAddressKey
options: NSKeyValueObservingOptionNew
context: NULL];
// Show the window

[[self window] setFrameAutosaveName:@"Prefs Window"];
[[self window] makeKeyAndOrderFront: self];

}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ([keyPath isEqualTo: kEmailAddressKey])
{
// EmailSender *providerCheck = [[EmailSender alloc] init];
// [providerCheck findProviderForEmail: [change objectForKey:NSKeyValueChangeNewKey]];

}
}


@end
Oops, something went wrong.

0 comments on commit 9e77ed0

Please sign in to comment.
You can’t perform that action at this time.