Changeset 984


Ignore:
Timestamp:
02/01/09 13:07:46 (3 years ago)
Author:
james
Message:

Support onload enable/disable of plugins as per settings file

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/settings.sample.tcl

    r983 r984  
    171171#set bMotionSettings(censorbeep) "BEEP" 
    172172 
     173# Enable or disable output plugins at startup 
     174# Format: 
     175#    plugin1:1,plugin2:0,plugin3=#channel 
     176# Enable plugin1 globally, disable plugin2 globally, and enable plugin3 on #channel 
     177# To enable a plugin on more than one channel, list it more than once 
     178# Example: "typos:0,welsh=#wales,dutch:1" 
     179set bMotionSettings(output_preenable) "" 
    173180 
    174181### Flood checking 
  • trunk/plugins/output.tcl

    r750 r984  
    3131  } 
    3232} 
     33 
     34# enable or disable plugins as per the settings file 
     35# setting format: 
     36# pluginname1:1,pluginname2=#channel,pluginname3:0 
     37# enables pluginname1 globally, pluginname2 on #channel, and disables pluginname3 
     38 
     39set output_preenables [split [bMotion_setting_get "output_preenables"] ","] 
     40 
     41foreach output_preenable $output_preenables { 
     42        if {[string range $output_preenable end-1 end] == ":1"} { 
     43                set plugin [string range $output_preenable 0 [expr [string last ":1" $output_preenable] - 1]] 
     44                bMotion_putloglev d * "Globally enabling output plugin $plugin from settings file" 
     45                bMotion_plugin_set_output $plugin 1 
     46                continue 
     47        } 
     48 
     49        if {[string range $output_preenable end-1 end] == ":0"} { 
     50                set plugin [string range $output_preenable 0 [expr [string last ":1" $output_preenable] - 1]] 
     51                bMotion_putloglev d * "Globally disabling output plugin $plugin from settings file" 
     52                bMotion_plugin_set_output $plugin 0 
     53                continue 
     54        } 
     55 
     56        if [string match "*=*" $output_preenable] { 
     57                set plugin [string range $output_preenable 0 [expr [string last "=" $output_preenable] - 1]] 
     58                set chan [string range $output_preenable [expr [string last "=" $output_preenable] + 1] end] 
     59                bMotion_putloglev d * "Enabling output plugin $plugin on channel $chan from settings file" 
     60                bMotion_plugin_set_output_channel $plugin $chan 1 
     61                continue 
     62        } 
     63 
     64        putlog "bMotion: ERROR parsing output_preenables: not sure what to do with $output_preenable" 
     65} 
     66 
Note: See TracChangeset for help on using the changeset viewer.