Changeset 1026 for trunk/modules/output.tcl
- Timestamp:
- 08/29/09 04:42:03 (3 years ago)
- File:
-
- 1 edited
-
trunk/modules/output.tcl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/output.tcl
r1022 r1026 121 121 } 122 122 123 # 124 # our magic output function 125 proc bMotionDoAction {channel nick text {moreText ""} {noTypo 0} {urgent 0} } { 126 bMotion_putloglev 5 * "bMotionDoAction($channel,$nick,$text,$moreText,$noTypo,$urgent)" 127 global bMotionInfo bMotionCache bMotionOriginalInput 128 global bMotion_output_delay bMotionSettings BMOTION_SLEEP 129 130 set bMotion_output_delay 0 131 132 #check our global toggle 133 global bMotionGlobal 134 if {$bMotionGlobal == 0} { 135 return 0 136 } 137 138 set bMotionCache($channel,last) 1 139 140 # check if we're asleep 141 if {[bMotion_setting_get "asleep"] == $BMOTION_SLEEP(ASLEEP)} { 142 return 0 143 } 144 145 if [regexp "^\[#!\].+" $channel] { 146 set channel [string tolower $channel] 147 if {![channel get $channel bmotion]} { 148 bMotion_putloglev d * "bMotion: aborting bMotionDoAction ... $channel not allowed" 149 return 0 150 } 151 } 152 153 if {[bMotion_setting_get "silence"] == 1} { 154 return 0 155 } 156 catch { 157 if {$bMotionInfo(adminSilence,$channel) == 1} { 158 return 0 159 } 160 } 161 162 switch [rand 3] { 163 0 { } 164 1 { set nick [string tolower $nick] } 165 2 { set nick "[string range $nick 0 0][string tolower [string range $nick 1 end]]" } 166 } 167 168 # Process macros 123 proc bMotion_process_macros { channel text } { 169 124 170 125 set done 0 … … 174 129 set current_pos [string first "%" $text $current_pos] 175 130 if {$current_pos == -1} { 176 # no more matches131 # no more matches 177 132 set done 1 178 133 continue … … 180 135 bMotion_putloglev d * "macro: found a % at $current_pos" 181 136 if {$current_pos < [string length $text]} { 182 # this isn't a % at the end of the line137 # this isn't a % at the end of the line 183 138 if {[string index $text [expr $current_pos + 1]] == "|"} { 184 139 set current_pos [expr $current_pos + 2] … … 192 147 set plugin [bMotion_plugin_find_output "en" "" 0 10 $macro] 193 148 if {[llength $plugin] == 1} { 194 # call plugin149 # call plugin 195 150 bMotion_putloglev d * "macro: found matching plugin for macro [lindex $plugin 0]" 196 151 set result "" … … 235 190 incr current_pos 236 191 } 192 193 return $text 194 } 195 196 # 197 # our magic output function 198 proc bMotionDoAction {channel nick text {moreText ""} {noTypo 0} {urgent 0} } { 199 bMotion_putloglev 5 * "bMotionDoAction($channel,$nick,$text,$moreText,$noTypo,$urgent)" 200 global bMotionInfo bMotionCache bMotionOriginalInput 201 global bMotion_output_delay bMotionSettings BMOTION_SLEEP 202 203 set bMotion_output_delay 0 204 205 #check our global toggle 206 global bMotionGlobal 207 if {$bMotionGlobal == 0} { 208 return 0 209 } 210 211 set bMotionCache($channel,last) 1 212 213 # check if we're asleep 214 if {[bMotion_setting_get "asleep"] == $BMOTION_SLEEP(ASLEEP)} { 215 return 0 216 } 217 218 if [regexp "^\[#!\].+" $channel] { 219 set channel [string tolower $channel] 220 if {![channel get $channel bmotion]} { 221 bMotion_putloglev d * "bMotion: aborting bMotionDoAction ... $channel not allowed" 222 return 0 223 } 224 } 225 226 if {[bMotion_setting_get "silence"] == 1} { 227 return 0 228 } 229 catch { 230 if {$bMotionInfo(adminSilence,$channel) == 1} { 231 return 0 232 } 233 } 234 235 switch [rand 3] { 236 0 { } 237 1 { set nick [string tolower $nick] } 238 2 { set nick "[string range $nick 0 0][string tolower [string range $nick 1 end]]" } 239 } 240 241 # Process macros 242 243 set text [bMotion_process_macros $channel $text] 237 244 238 245 # Run the plugins :D … … 482 489 } 483 490 484 regsub -all "% %" $line "%percent" line491 regsub -all "%" $line "%percent" line 485 492 486 493 return $line
Note: See TracChangeset
for help on using the changeset viewer.
