Changeset 941 for trunk/modules/events.tcl
- Timestamp:
- 02/07/2008 10:26:11 (5 months ago)
- Files:
-
- 1 modified
-
trunk/modules/events.tcl (modified) (27 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/events.tcl
r939 r941 21 21 ############################################################################### 22 22 23 ### bMotionDoEventResponse <<<123 ### bMotionDoEventResponse 24 24 proc bMotionDoEventResponse { type nick host handle channel text } { 25 25 #check our global toggle … … 68 68 } 69 69 70 ### bMotion_event_onjoin <<<170 ### bMotion_event_onjoin 71 71 proc bMotion_event_onjoin {nick host handle channel} { 72 72 #ignore me … … 93 93 94 94 95 ### bMotion_event_onpart <<<195 ### bMotion_event_onpart 96 96 proc bMotion_event_onpart {nick host handle channel {msg ""}} { 97 97 #check our global toggle … … 120 120 } 121 121 122 ### bMotion_event_onquit <<<1122 ### bMotion_event_onquit 123 123 proc bMotion_event_onquit {nick host handle channel reason} { 124 124 global bMotionSettings bMotionInfo … … 155 155 } 156 156 157 ### bMotion_event_main <<<1157 ### bMotion_event_main 158 158 proc bMotion_event_main {nick host handle channel text} { 159 159 #check our global toggle … … 176 176 set channel [string tolower $channel] 177 177 178 #ignore other bots <<<2178 #ignore other bots 179 179 if {[matchattr $handle b] && (![matchattr $handle I])} { 180 180 set bMotionCache($channel,last) 0 … … 182 182 } 183 183 184 #make sure we're allowed to talk in here <<<2184 #make sure we're allowed to talk in here 185 185 if {![channel get $channel bmotion]} { 186 186 return 0 187 187 } 188 188 189 #don't trigger on !seen etc <<<2189 #don't trigger on !seen etc 190 190 if [regexp -nocase "^!(last)?seen" $text] { 191 191 return 0 … … 197 197 } 198 198 199 #>>>200 201 199 bMotion_putloglev 4 * "bMotion: entering bMotion_event_main with nick: $nick host: $host handle: $handle chan: $channel text: $text" 202 200 203 201 set bMotionOriginalInput $text 204 202 205 #filter bold, etc codes out <<<2203 #filter bold, etc codes out 206 204 regsub -all "\002" $text "" text 207 205 regsub -all "\022" $text "" text … … 218 216 bMotion_check_botnicks 219 217 220 #does this look like a paste? <<<2218 #does this look like a paste? 221 219 if [regexp -nocase {^[([]?[0-9]{2}[-:.][0-9]{2}. ?[[<(]?[%@+]?[a-z0-9` ]+[@+%]?. \w+} $text] { 222 220 return 0 223 221 } 224 #>>>225 222 226 223 ## Update the channel idle tracker 227 224 set bMotionLastEvent($channel) [clock seconds] 228 225 229 #don't let people break us <<<2226 #don't let people break us 230 227 if {![matchattr $handle n]} { 231 228 if [regexp -nocase "%(pronoun|me|noun|colen|percent|VAR|\\|)" $text] { … … 235 232 regsub -all "\</" $text "%slash" text 236 233 237 #If this isn't just a smiley of some kind, trim smilies <<<2234 #If this isn't just a smiley of some kind, trim smilies 238 235 if {[string length $text] >= ([string length $botnick] + 4)} { 239 regsub -all -nocase {[;:=]-?[ )D>/]} $text "" text236 regsub -all -nocase {[;:=]-?[()d<>/sp9x]} $text "" text 240 237 regsub -all {([\-^])_*[\-^];*} $text "" text 241 238 regsub -all {\\o/} $text "" text 242 239 } 243 240 244 #Trim stuff <<<2241 #Trim stuff 245 242 set text [string trim $text] 246 243 247 ## Dump double+ spaces #244 ## Dump double+ spaces 248 245 regsub -all " +" $text " " text 249 #>>>250 246 251 247 ## Update the last-talked flag for the join system … … 254 250 set bMotionThisText $text 255 251 256 #if we spoke last, add "$botnick: " if it's not in the line <<<2252 #if we spoke last, add "$botnick: " if it's not in the line 257 253 if {![regexp -nocase $botnicks $text] && ([bMotion_did_i_speak_last $channel] || [bMotion_setting_get "bitlbee"])} { 258 254 if [regexp {^[^:]+:.+} $text] { … … 262 258 set text "${botnick}: $text" 263 259 } 264 #>>>265 260 266 261 if [bMotion_setting_get "bitlbee"] { … … 268 263 } 269 264 270 #check for someone breaking the loop of lastSpoke <<<2265 #check for someone breaking the loop of lastSpoke 271 266 if {[regexp -nocase "(i'm not talking to|not) you" $text] && $bMotionCache($channel,last)} { 272 267 bMotionDoAction $channel $nick "oh" … … 275 270 } 276 271 set bMotionCache($channel,last) 0 277 #>>> 278 279 #Run the simple plugins <<<2 272 273 #Run the simple plugins 280 274 set response [bMotion_plugin_find_simple $text $bMotionInfo(language)] 281 275 if {$response != ""} { … … 287 281 } 288 282 289 #Run the complex plugins <<<2283 #Run the complex plugins 290 284 set response [bMotion_plugin_find_complex $text $bMotionInfo(language)] 291 285 if {[llength $response] > 0} { … … 316 310 } 317 311 318 #Check for all caps <<<2312 #Check for all caps 319 313 regsub -all {[^A-Za-z]} $text "" textChars 320 314 regsub -all {[a-z]} $textChars "" textLowerChars … … 327 321 } 328 322 } 329 #>>> 330 331 #Reload config files <<<2 323 324 #Reload config files 332 325 #TODO: move this into a plugin? 333 326 if [regexp -nocase "${botnicks},?:? re(hash|load)( your config files?)?" $text] { … … 364 357 } 365 358 366 #tell the names we have <<<2359 #tell the names we have 367 360 #TODO: move this into a plugin? 368 361 if [regexp -nocase "${botnicks}:?,? say my names?(,? bitch)?" $text] { … … 389 382 } 390 383 391 #shut up <<<2384 #shut up 392 385 #TODO: move this into a plugin? 393 386 if [regexp -nocase "^${botnicks}:?,? (silence|shut up|be quiet|go away)" $text] { … … 403 396 } 404 397 405 #catch actions in stars <<<2398 #catch actions in stars 406 399 #This is the clever bit. If the text is "*blah blah blah*" reinject it into bMotion as an action ## 407 400 if [regexp {^\*(.+)\*$} $text blah action] { … … 412 405 } 413 406 414 ### bMotion_event_action <<<1407 ### bMotion_event_action 415 408 proc bMotion_event_action {nick host handle dest keyword text} { 416 409 … … 442 435 set nick [bMotion_cleanNick $nick $handle] 443 436 444 #Trim <<<2437 #Trim 445 438 set text [string trim $text] 446 439 … … 454 447 bMotion_check_botnicks 455 448 456 #Run the simple plugins <<<2449 #Run the simple plugins 457 450 set response [bMotion_plugin_find_action_simple $text $bMotionInfo(language)] 458 451 if {$response != ""} { … … 464 457 } 465 458 466 #Run the complex plugins <<<2459 #Run the complex plugins 467 460 set response [bMotion_plugin_find_action_complex $text $bMotionInfo(language)] 468 461 if {[llength $response] > 0} { … … 485 478 return 0 486 479 } 487 #>>> 488 } 489 490 ### bMotion_event_mode <<<1 480 } 481 482 ### bMotion_event_mode 491 483 proc bMotion_event_mode {nick host handle channel mode victim} { 492 484 #check our global toggle … … 530 522 } 531 523 532 ### bMotion_event_nick <<<1524 ### bMotion_event_nick 533 525 proc bMotion_event_nick { nick host handle channel newnick } { 534 526 … … 553 545 } 554 546 555 # >>>556 547 bMotion_putloglev d * "bMotion: events module loaded"
