Changeset 883 for trunk

Show
Ignore:
Timestamp:
11/02/2008 18:45:21 (9 months ago)
Author:
james
Message:

fixed going to sleep output

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/system.tcl

    r882 r883  
    941941# go to sleep 
    942942proc bMotion_go_to_sleep { } { 
    943         # ok this is the plan 
    944         # 1. announce we feel tired 
    945         # 2. ??? 
    946         # 3. sleep 
     943# ok this is the plan 
     944# 1. announce we feel tired 
     945# 2. ??? 
     946# 3. sleep 
    947947        global bMotionSettings BMOTION_SLEEP bMotionChannels 
    948948        bMotion_update_chanlist 
     
    951951                bMotion_putloglev 3 * "considering awake -> bedtime" 
    952952                if {[rand 10] > 3} { 
    953                         # announce we're tired 
     953                # announce we're tired 
    954954                        set bMotionSettings(asleep) $BMOTION_SLEEP(BEDTIME) 
    955955                        putlog "bMotion: preparing to go to bed" 
     
    970970                bMotion_putloglev 3 * "considering bedtime -> sleep" 
    971971                if {[rand 10] > 3} { 
    972                         set bMotionSettings(asleep) $BMOTION_SLEEP(ASLEEP) 
    973                         putserv "AWAY :ZzZz" 
    974                         # go to sleep 
    975                         foreach chan $bMotionChannels { 
    976                                 if [bMotion_is_active_enough $chan] { 
    977                                         bMotion_putloglev 3 * "sending sleeping output to $chan" 
    978                                         bMotionDoAction $chan "" "%VAR{go_sleeps}" 
    979                                 } 
    980                         } 
    981                         putlog "bMotion: gone to sleep" 
     972                # go to sleep 
    982973                        set hour [bMotion_setting_get "wakeytime_hour"] 
    983974                        set minute [bMotion_setting_get "wakeytime_minute"] 
    984975                        set bMotionSettings(sleepy_nextchange) [bMotion_sleep_next_event "$hour:$minute"] 
     976                        catch { 
     977                                foreach chan $bMotionChannels { 
     978                                        if [bMotion_is_active_enough $chan] { 
     979                                                bMotion_putloglev 3 * "sending sleeping output to $chan" 
     980                                                bMotionDoAction $chan "" "%VAR{go_sleeps}" 
     981                                        } 
     982                                } 
     983                        } 
     984                        set bMotionSettings(asleep) $BMOTION_SLEEP(ASLEEP) 
     985                        putserv "AWAY :ZzZz" 
     986                        putlog "bMotion: gone to sleep" 
    985987                        return 
    986988                } else { 
     
    10021004                        set bMotionSettings(asleep) $BMOTION_SLEEP(AWAKE) 
    10031005                        putserv "AWAY" 
     1006 
     1007                        set hour [bMotion_setting_get "bedtime_hour"] 
     1008                        set minute [bMotion_setting_get "bedtime_minute"] 
     1009                        set bMotionSettings(sleepy_nextchange) [bMotion_sleep_next_event "$hour:$minute"] 
    10041010 
    10051011                        foreach chan $bMotionChannels { 
     
    10121018                        } 
    10131019                         
    1014                         set hour [bMotion_setting_get "bedtime_hour"] 
    1015                         set minute [bMotion_setting_get "bedtime_minute"] 
    1016                         set bMotionSettings(sleepy_nextchange) [bMotion_sleep_next_event "$hour:$minute"] 
    10171020                        return 
    10181021                } else {