--- Slim/Player/Client.pm.alarm 2009-08-29 03:00:12.000000000 -0700 +++ Slim/Player/Client.pm 2009-08-29 04:27:15.000000000 -0700 @@ -556,6 +556,7 @@ Slim::Buttons::Input::Choice::forgetClient($client); Slim::Buttons::Playlist::forgetClient($client); Slim::Buttons::Search::forgetClient($client); + Slim::Utils::Alarm->forgetClient($client); Slim::Utils::Timers::forgetTimer($client); if ( !main::SLIM_SERVICE && !main::SCANNER ) { --- Slim/Utils/Alarm.pm.alarm 2009-08-29 03:00:13.000000000 -0700 +++ Slim/Utils/Alarm.pm 2009-08-30 00:44:23.000000000 -0700 @@ -1269,6 +1269,34 @@ return $client->alarmData->{alarms}->{$id}; } +=head2 forgetClient( $client ) + +Clear alarms for a given client and unschedule the next alarm. This should be called +whenever a client is forgotten. + +=cut + +sub forgetClient { + my $class = shift; + my $client = shift; + + $log->debug('Forgetting saved alarms for ' . $client->name); + + $client->alarmData->{alarms} = {}; + + # Now that alarm list is cleared, this should handle clearing the + # nextAlarm and removing the timer + $class->scheduleNext($client); + + # Clear any existing RTC timers + my $timerRef = $client->alarmData->{_rtcTimerRef}; + if (defined $timerRef) { + # Kill previous rtc alarm timer + Slim::Utils::Timers::killSpecific($timerRef); + delete $client->alarmData->{_rtcTimerRef}; + } +} + =head2 loadAlarms( $client ) Load the alarms for a given client and schedule the next alarm. This should be called