Now removing items from the submission queue after success.
[MenuTunes.git] / PreferencesController.m
index 61e0c11..638be40 100755 (executable)
@@ -6,6 +6,7 @@
 #import "StatusWindow.h"
 #import "StatusWindowController.h"
 #import "CustomMenuTableView.h"
+#import "AudioscrobblerController.h"
 
 #import <Security/Security.h>
 
@@ -85,6 +86,10 @@ static PreferencesController *prefs = nil;
        SecKeychainAttribute attributes[3];
        SecKeychainAttributeList list;
 
+       if ((user == nil) || ([user length] == 0)) {
+               return nil;
+       }
+
        ITDebugLog(@"Audioscrobbler: Searching for keychain item for %@.", user);
        attributes[0].tag = kSecAccountItemAttr;
        attributes[0].data = (char *)[user UTF8String];
@@ -433,6 +438,7 @@ static PreferencesController *prefs = nil;
                                [PreferencesController deleteKeychainItemForUser:currentAccount];
                        }
                        [PreferencesController createKeychainItemForUser:newAccount andPassword:[audioscrobblerPasswordTextField stringValue]];
+                       [[AudioscrobblerController sharedController] attemptHandshake:YES];
                }
        } else if ( [sender tag ] == 6030) {
                //Here we set the password for an existing keychain item or we create a new keychain item.