Changeset 1003 for trunk/modules/system.tcl
- Timestamp:
- 04/23/09 05:28:08 (3 years ago)
- File:
-
- 1 edited
-
trunk/modules/system.tcl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/system.tcl
r997 r1003 104 104 } 105 105 106 # 107 # get the last event for a channel, or 0 if not available 108 proc bMotion_get_last_event { channel } { 109 bMotion_putloglev 4 * "bMotion_get_last_event $channel" 110 111 global bMotionLastEvent 112 113 set last_event 0 114 catch { 115 set last_event $bMotionLastEvent($channel) 116 } 117 if {$last_event == 0} { 118 bMotion_putloglev 1 * "last event for $channel is not available, returning 0" 119 } 120 121 return $last_event 122 } 123 124 # 125 # set the last event time for a channel to now 126 proc bMotion_set_last_event { channel } { 127 bMotion_putloglev 4 * "bMotion_set_last_event $channel" 128 129 global bMotionLastEvent 130 131 set bMotionLastEvent($channel) [clock seconds] 132 } 106 133 107 134 # … … 109 136 proc bMotion_is_active_enough { channel { limit 0 } } { 110 137 global bMotionInfo 111 global bMotionLastEvent112 138 113 139 bMotion_putloglev 4 * "bMotion_is_active_enough $channel" 114 140 115 set last_event 0 116 catch { 117 set last_event $bMotionLastEvent($channel) 118 } 141 set last_event [bMotion_get_last_event $channel] 142 119 143 if {$last_event == 0} { 120 144 bMotion_putloglev d * "last event info for $channel not available" 121 145 # force it to be now 122 set bMotionLastEvent($channel) [clock seconds]146 bMotion_set_last_event $channel 123 147 # assume we're ok 124 148 return 1 … … 140 164 # check if every channel we can see is idle enough for us to go away 141 165 proc bMotion_random_away {} { 142 global bMotion LastEvent bMotionChannels bMotionInfo166 global bMotionChannels bMotionInfo 143 167 144 168 set timeNow [clock seconds] … … 160 184 foreach channel $bMotionChannels { 161 185 catch { 162 append line "$channel=$bMotionLastEvent($channel) " 163 if {$bMotionLastEvent($channel) > $mostRecent} { 164 set mostRecent $bMotionLastEvent($channel) 186 set last_event [bMotion_get_last_event $channel] 187 append line "$channel=$last_event " 188 if {$last_event > $mostRecent} { 189 set mostRecent $last_event 165 190 } 166 191 } … … 192 217 proc doRandomStuff {} { 193 218 global bMotionInfo mood stonedRandomStuff bMotionSettings 194 global bMotion LastEvent bMotionOriginalNick bMotionChannels219 global bMotionOriginalNick bMotionChannels 195 220 global BMOTION_SLEEP 196 221
Note: See TracChangeset
for help on using the changeset viewer.
