OK, so it doesn't hurt performance too much to get called every time any
settings are changed, and I guess that makes sense. So I'll do something
similar to this, and check my own settings whenever any settings are
changed, and if any of my settings have changed I can re-initialize (I
don't want to re-initialize when any other settings change because that
resets timers and such, which would not be good).

Thanks for your help, I'm close to being able to submit this script now.

Mike

On Thu, Mar 25, 2004 at 09:31:34PM +0100, Geert Hauwaerts wrote:
> On Thu, 2004-03-25 at 20:44, Mike Weisenborn wrote:
> > I'd like to do that when I clean it up a bit. One thing I'd like to do
> > is have it auto-recognize when its settings have changed and then reload
> > them. I tried catching the signal "setup changed" but it doesn't send
> > any parameters.
> 
> This is a sub I wrote to check the settings. (Kinlo could have written this sub too, 
> can't recall of him or me wrote it)
> 
> sub check_settings {
> 
>     my $trackbar_style  = Irssi::settings_get_str('trackbar_style');
>     my $trackbar_string = Irssi::settings_get_str('trackbar_string');
> 
>     if ($trackbar_style !~ /^%[kKbBgGcCrRmMpPyYwW]$/) {
>         Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'trackbar_wrong_style');
>         Irssi::settings_set_str('trackbar_style',  => '%K');
>     }
> 
>     if (!$trackbar_string) {
>         Irssi::printformat(MSGLEVEL_CLIENTCRAP,
> 'trackbar_wrong_string');
>         Irssi::settings_set_str('trackbar_string' => default_string());
>     }
> 
>     if ($trackbar_string =~ /%/) {
>         Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'trackbar_not_allowed');
>         Irssi::settings_set_str('trackbar_string' => default_string());
>     }
> 
>     if (!$_[0]) {
>         resize_all();
>     }
> }
> 
> Irssi::signal_add('setup changed', 'check_settings');
> 
> Regards,
> Geert Hauwaerts.
> 
> -- 
> .---------------------------------------------------------------------------.
> | Geert Hauwaerts          http://www.safeweb.be         <[EMAIL PROTECTED]> |
> | Certified Unix/Linux Administrator  ||  Cisco Certified Network Associate |
> `---------------------------------------------------------------------------'
> 

-- 
Mike Weisenborn, Senior Partner
[EMAIL PROTECTED] 770-886-0443 www.clearbuilt.com

Clearbuilt Technologies - consulting, development and education
for the real estate and construction industries

Reply via email to