Ignore:
Timestamp:
08/29/09 04:42:03 (3 years ago)
Author:
james
Message:

Add diagnostic to parse all abstracts and report any broken ones

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/output.tcl

    r1022 r1026  
    121121} 
    122122 
    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 
     123proc bMotion_process_macros { channel text } { 
    169124 
    170125        set done 0 
     
    174129                set current_pos [string first "%" $text $current_pos] 
    175130                if {$current_pos == -1} { 
    176                         # no more matches 
     131                # no more matches 
    177132                        set done 1 
    178133                        continue 
     
    180135                bMotion_putloglev d * "macro: found a % at $current_pos" 
    181136                if {$current_pos < [string length $text]} { 
    182                         # this isn't a % at the end of the line 
     137                # this isn't a % at the end of the line 
    183138                        if {[string index $text [expr $current_pos + 1]] == "|"} { 
    184139                                set current_pos [expr $current_pos + 2] 
     
    192147                                set plugin [bMotion_plugin_find_output "en" "" 0 10 $macro] 
    193148                                if {[llength $plugin] == 1} { 
    194                                         # call plugin 
     149                                # call plugin 
    195150                                        bMotion_putloglev d * "macro: found matching plugin for macro [lindex $plugin 0]" 
    196151                                        set result "" 
     
    235190                incr current_pos 
    236191        } 
     192 
     193        return $text 
     194} 
     195 
     196# 
     197# our magic output function 
     198proc 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] 
    237244 
    238245        # Run the plugins :D 
     
    482489        } 
    483490 
    484         regsub -all "%%" $line "%percent" line 
     491        regsub -all "%" $line "%percent" line 
    485492 
    486493        return $line 
Note: See TracChangeset for help on using the changeset viewer.