Ignore:
Timestamp:
09/11/09 14:40:18 (3 years ago)
Author:
james
Message:

update %ruser to be cool

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/en/output_ruser.tcl

    r1019 r1033  
    1111############################################################################### 
    1212 
     13# %ruser 
     14# %ruser{friend} 
     15# %ruser{friend:owner} 
     16# %ruser{:owner} 
    1317 
    1418proc bMotion_plugin_output_ruser { channel line } { 
    1519        bMotion_putloglev 4 * "bMotion_plugin_output_ruser $channel $line" 
    1620 
    17         if {[regexp "%ruser(\{(\[^\}\]+)\})?" $line matches param condition]} { 
    18                 set ruser [bMotionGetRealName [bMotion_choose_random_user $channel 0 $condition] ""] 
    19                 if {$condition == ""} { 
    20                         set findString "%ruser" 
    21                 } else { 
    22                         set findString "%ruser$param" 
     21        if [regexp "%ruser(\{(\[a-z\]*)?(:(\[a-z,\]+))?\})?" $line matches allopts filter optstring options] { 
     22                bMotion_putloglev 1 * "found %ruser with filter=$filter and options=$options" 
     23 
     24                set ruser [bMotionGetRealName [bMotion_choose_random_user $channel 0 $filter] ""] 
     25                 
     26                set options_list [split $options ","] 
     27                foreach option $options_list { 
     28                        bMotion_putloglev 1 * "working on option $option" 
     29                        switch $option { 
     30                                "owner" { 
     31                                        set ruser [bMotionMakePossessive $ruser] 
     32                                } 
     33                                "caps" { 
     34                                        set ruser [string toupper $ruser] 
     35                                } 
     36                                default { 
     37                                        putlog "bMotion: unexpected option $option in $matches" 
     38                                } 
     39                        } 
    2340                } 
    24                 regsub $findString $line $ruser line 
     41                regsub $matches $line $ruser line 
    2542        } 
     43 
    2644        return $line 
    2745} 
Note: See TracChangeset for help on using the changeset viewer.