Fixing the bug preventing iPod playlists from showing in the menu
[MenuTunes.git] / NetworkObject.m
index 5ab7c79..32bbbc8 100755 (executable)
@@ -1,10 +1,19 @@
-//
-//  NetworkObject.m
-//  MenuTunes
-//
-//  Created by Kent Sutherland on Tue Oct 28 2003.
-//  Copyright (c) 2003 __MyCompanyName__. All rights reserved.
-//
+/*
+ *  MenuTunes
+ *  NetworkObject
+ *    Remote network object that is vended
+ *
+ *  Original Author : Kent Sutherland <ksutherland@ithinksw.com>
+ *   Responsibility : Kent Sutherland <ksutherland@ithinksw.com>
+ *
+ *  Copyright (c) 2002 - 2003 iThink Software.
+ *  All Rights Reserved
+ *
+ *     This header defines the Objective-C protocol which all MenuTunes Remote
+ *  plugins must implement.  To build a remote, create a subclass of this
+ *  object, and implement each method in the @protocol below.
+ *
+ */
 
 #import "NetworkObject.h"
 #import "MainController.h"
 
 #import "NetworkObject.h"
 #import "MainController.h"
 
 @implementation NetworkObject
 
 
 @implementation NetworkObject
 
+- (id)init
+{
+    if ( (self = [super init]) ) {
+        if (![self requiresPassword]) {
+            _authenticated = YES;
+        } else {
+            _authenticated = NO;
+        }
+    }
+    return self;
+}
+
 - (ITMTRemote *)remote
 {
 - (ITMTRemote *)remote
 {
-    return [[MainController sharedController] currentRemote];
+    if (_authenticated)
+        return [[MainController sharedController] currentRemote];
+    else
+        return nil;
 }
 
 - (NSString *)serverName
 }
 
 - (NSString *)serverName
     return name;
 }
 
     return name;
 }
 
+- (BOOL)requiresPassword
+{
+    return [[NSUserDefaults standardUserDefaults] boolForKey:@"enableSharingPassword"];
+}
+
+- (BOOL)sendPassword:(NSData *)password
+{
+    if ([password isEqualToData:[[NSUserDefaults standardUserDefaults] dataForKey:@"sharedPlayerPassword"]]) {
+        _authenticated = YES;
+        return YES;
+    } else {
+        _authenticated = NO;
+        return NO;
+    }
+}
+
 @end
 @end