Changeset 1069
- Timestamp:
- 02/01/10 18:59:10 (2 years ago)
- Location:
- trunk/modules
- Files:
-
- 2 edited
-
events.tcl (modified) (8 diffs)
-
flood.tcl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/events.tcl
r961 r1069 266 266 267 267 #check for someone breaking the loop of lastSpoke 268 if {[regexp -nocase "(i'm not talking to|not) you" $text] && $bMotionCache($channel,last)} {268 if {[regexp -nocase "(i'm not talking to|not) you" $text] && [bMotion_did_i_speak_last $channel]} { 269 269 bMotionDoAction $channel $nick "oh" 270 270 set bMotionCache($channel,last) 0 … … 278 278 bMotion_flood_add $nick "" $text 279 279 if [bMotion_flood_check $nick] { return 0 } 280 if [bMotion_flood_check $channel] { return 0 } 281 bMotion_flood_add $channel "" $text 280 282 set nick [bMotionGetRealName $nick $host] 281 283 bMotionDoAction $channel $nick [pickRandom $response] … … 287 289 if {[llength $response] > 0} { 288 290 #set nick [bMotionGetRealName $nick $host] 291 if [bMotion_flood_check $channel] { return 0 } 289 292 bMotion_putloglev 1 * "going to run plugins: $response" 290 293 foreach callback $response { … … 295 298 set result 0 296 299 set result [$callback $nick $host $handle $channel $text] 300 bMotion_putloglev d * "returned from $callback" 297 301 set bMotionCache(lastPlugin) $callback 298 302 bMotion_plugin_history_add $channel "complex" $callback … … 304 308 if {$result > 0} { 305 309 if {$result == 1} { 310 bMotion_putloglev 1 * "adding flood counters" 306 311 bMotion_flood_add $nick $callback $text 312 bMotion_flood_add $channel $callback $text 307 313 } 308 314 bMotion_putloglev 2 * "bMotion: `-$callback returned $result, breaking out..." … … 453 459 if {$response != ""} { 454 460 bMotion_flood_add $nick "" $text 461 if [bMotion_flood_check $nick] { return 0 } 462 if [bMotion_flood_check $channel] { return - } 463 bMotion_flood_add $channel "" $text 455 464 bMotion_putloglev 1 * "bMotion: matched simple action plugin, outputting $response..." 456 465 set nick [bMotionGetRealName $nick $host] … … 463 472 if {[llength $response] > 0} { 464 473 #set nick [bMotionGetRealName $nick $host] 474 if [bMotion_flood_check $channel] { return 0 } 465 475 bMotion_putloglev 1 * "going to run action plugins: $response" 466 476 foreach callback $response { … … 473 483 if {$result == 1} { 474 484 bMotion_flood_add $nick $callback $text 485 bMotion_flood_add $channel $callback $text 475 486 } 476 487 bMotion_putloglev 2 * "bMotion: `-$callback returned $result, breaking out..." -
trunk/modules/flood.tcl
r939 r1069 82 82 83 83 set val 1 84 if [validuser $nick] { 85 set handle $nick 86 } else { 87 set handle [nick2hand $nick] 88 if {$handle == "*"} { 89 set handle $nick 90 } 91 } 84 if {[string index $nick 0] != "#"} { 85 if [validuser $nick] { 86 set handle $nick 87 } else { 88 set handle [nick2hand $nick] 89 if {$handle == "*"} { 90 set handle $nick 91 } 92 bMotion_putloglev d * "Using handle $handle as flood target (was $nick)" 93 } 94 } else { 95 bMotion_putloglev d * "Using channel $nick as flood target" 96 set handle $nick 97 } 92 98 set lastCallback "" 93 99 catch { … … 196 202 197 203 proc bMotion_flood_get { nick } { 198 global bMotion_flood_info 199 if [validuser $nick] { 200 set handle $nick 201 } else { 202 set handle [nick2hand $nick] 203 if {$handle == "*"} { 204 set handle $nick 205 } 206 } 207 set flood 0 208 catch { 204 global bMotion_flood_info 205 if {[string index $nick 0] != "#"} { 206 if [validuser $nick] { 207 set handle $nick 208 } else { 209 set handle [nick2hand $nick] 210 if {$handle == "*"} { 211 set handle $nick 212 } 213 } 214 } else { 215 set handle $nick 216 } 217 set flood 0 218 catch { 209 219 set flood $bMotion_flood_info($handle) 210 220 } … … 226 236 set flood [bMotion_flood_get $nick] 227 237 set chance 2 228 if {$flood > 35} { 229 set chance -1 230 } 231 232 if {$flood > 25} { 233 set chance -1 234 } 235 236 if {$flood > 15} { 237 set chance 1 238 } 239 set r [rand 2] 240 if {!($r < $chance)} { 241 putlog "bMotion: FLOOD check on $nick (http://www.bmotion.net:8000/bmotion/wiki/FAQDisableFlood)" 242 return 1 243 } 238 239 if {[string index $nick 0] == "#"} { 240 set is_chan 1 241 } else { 242 set is_chan 0 243 } 244 245 if {!$is_chan} { 246 if {$flood > 35} { 247 set chance -1 248 } 249 250 if {$flood > 25} { 251 set chance -1 252 } 253 254 if {$flood > 15} { 255 set chance 1 256 } 257 set r [rand 2] 258 if {!($r < $chance)} { 259 putlog "bMotion: FLOOD check on $nick (http://www.bmotion.net:8000/bmotion/wiki/FAQDisableFlood)" 260 return 1 261 } 262 } else { 263 if {$flood > 35} { 264 putlog "bMotion: FLOOD protection for $nick (http://www.bmotion.net:8000/bmotion/wiki/FAQDisableFlood)" 265 return 1 266 } 267 } 244 268 return 0 245 269 }
Note: See TracChangeset
for help on using the changeset viewer.
