+/*************************************************************************/
+#pragma mark -
+#pragma mark NETWORK HANDLERS
+/*************************************************************************/
+
+- (void)setServerStatus:(BOOL)newStatus
+{
+ if (newStatus) {
+ //Turn on
+ [networkController setServerStatus:YES];
+ } else {
+ //Tear down
+ [networkController setServerStatus:NO];
+ }
+}
+
+- (BOOL)connectToServer
+{
+ //Connect
+ if ([networkController connectToHost:[df stringForKey:@"sharedPlayerHost"]]) {
+ currentRemote = [networkController sharedRemote];
+ [refreshTimer invalidate];
+ return YES;
+ } else {
+ currentRemote = [remoteArray objectAtIndex:0];
+ return NO;
+ }
+}
+
+- (BOOL)disconnectFromServer
+{
+ //Disconnect
+ currentRemote = [remoteArray objectAtIndex:0];
+ [networkController disconnect];
+ [self timerUpdate];
+ return YES;
+}
+
+- (void)networkError:(NSException *)exception
+{
+ ITDebugLog(@"Remote exception thrown: %@: %@", [exception name], [exception reason]);
+ NSRunAlertPanel(@"Remote MenuTunes Disconnected", @"The MenuTunes server you were connected to stopped responding or quit. MenuTunes will revert back to the local player.", @"OK", nil, nil);
+ if ([networkController isConnectedToServer] && [self disconnectFromServer]) {
+ } else {
+ ITDebugLog(@"CRITICAL ERROR DISCONNECTING!");
+ }
+}