Changeset 261 for trunk/modules/output.tcl
- Timestamp:
- 09/15/03 14:48:58 (9 years ago)
- File:
-
- 1 edited
-
trunk/modules/output.tcl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/output.tcl
r260 r261 465 465 } 466 466 467 proc bMotionGetRealName { nick { host "" }} {467 proc OLDbMotionGetRealName { nick { host "" }} { 468 468 bMotion_putloglev 4 * "bMotion: bMotionGetRealName($nick,$host)" 469 469 … … 500 500 } 501 501 putloglev 2 * "bMotion: found $handle, IRLs are $realname" 502 return [pickRandom $realname] 503 } 504 505 proc bMotionGetRealName { nick { host "" }} { 506 bMotion_putloglev 3 * "bMotion: bMotionGetRealName($nick,$host)" 507 508 if {$nick == ""} { 509 return "" 510 } 511 512 #is it me? 513 if [isbotnick $nick] { 514 return "me" 515 } 516 517 set handle [nick2hand $nick] 518 if {$handle == "*"} { 519 #not in bot 520 bMotion_putloglev 2 * "bMotion: no match, using nick" 521 #return [bMotionWashNick $nick] 522 return $nick 523 } 524 525 bMotion_putloglev 2 * "bMotion: $nick is handle $handle" 526 527 # found a user, now get their real name 528 set realname [getuser $handle XTRA irl] 529 if {$realname == ""} { 530 #not set 531 bMotion_putlogleg 2 * "no IRL set, using nick" 532 return $nick 533 } 534 putloglev 2 * "bMotion: IRLs for $handle are $realname" 502 535 return [pickRandom $realname] 503 536 } … … 593 626 594 627 proc bMotionChooseRandomUser { channel { conditions ""}} { 628 global botnick 595 629 bMotion_putloglev 2 * "bMotion: looking for a $conditions user" 596 global botnick 630 597 631 set users [chanlist $channel] 598 632 if {[llength $users] < 2} { … … 601 635 602 636 set userslist [list] 637 603 638 foreach user $users { 639 if [isbotnick $user] { 640 continue 641 } 642 604 643 set handle [nick2hand $user] 605 644 if [matchattr $handle b] { 606 645 continue 607 646 } 647 608 648 if {$conditions != ""} { 609 649 if [string match -nocase [getuser $handle XTRA gender] $conditions] { 610 650 lappend userslist $user 611 bMotion_putloglev 1 * "bMotion: accepting user $handlefor gender $conditions"651 bMotion_putloglev 2 * "bMotion: `- accepting nick $nick for gender $conditions" 612 652 } else { 613 653 if {($conditions == "like") && [bMotionLike $user [getchanhost $user]]} { 614 654 lappend userslist $user 615 655 } else { 616 bMotion_putloglev 2 * "bMotion: rejecting $handleon gender"656 bMotion_putloglev 2 * "bMotion: `- rejecting nick $nick on gender" 617 657 } 618 658 } … … 621 661 } 622 662 } 623 bMotion_putloglev 1 * "bMotion: found [llength $userslist] users in $channel, $userslist" 663 664 bMotion_putloglev 1 * "bMotion: found [llength $userslist] suitable users in $channel, $userslist" 665 666 #abort if no users 624 667 set users $userslist 625 668 if {[llength $users] == 0} { … … 627 670 } 628 671 672 #pass thru with first user if that's the only one 629 673 if {[llength $users] == 1} { 630 674 return [lindex $users 0] 631 675 } 632 676 633 set ruser $botnick 634 while {$ruser == $botnick} { 635 set ruser [lindex $users [rand [llength $users]]] 636 } 637 return $ruser 677 return [pickRandom $users] 638 678 } 639 679 640 680 proc bMotionChooseRandomBot { channel { conditions "" }} { 641 bMotion_putloglev 1 * "bMotion: checking $channel"642 681 global botnick bMotionInfo 682 bMotion_putloglev 1 * "bMotion: checking $channel for bots" 683 643 684 set bots [chanlist $channel] 644 685 set botslist [list] 686 645 687 foreach bot $bots { 646 688 if [isbotnick $bot] { continue } 647 689 set handle [nick2hand $bot $channel] 690 648 691 bMotion_putloglev 1 * "bMotion: checking $bot ($handle)" 649 692 if [matchattr [nick2hand $bot $channel] b&K $channel] { … … 670 713 } 671 714 672 set rbot $botnick 673 while {$rbot == $botnick} { 674 set rbot [lindex $bots [rand [llength $bots]]] 675 } 676 return $rbot 715 return [pickRandom $bots] 677 716 } 678 717
Note: See TracChangeset
for help on using the changeset viewer.
