From 61849414590f1aef81e4fa5537d27c11206cd00d Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Wed, 24 Nov 2010 17:53:00 +0000 Subject: uberprompt: now updates correctly for some additional expandos, such as $tag --- prompt_info/uberprompt.pl | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/prompt_info/uberprompt.pl b/prompt_info/uberprompt.pl index 9aa75b8..7bb03a2 100644 --- a/prompt_info/uberprompt.pl +++ b/prompt_info/uberprompt.pl @@ -145,6 +145,9 @@ my $use_replaces = 0; my $emit_request = 0; +my $expando_refresh_timer; +my $expando_vars = {}; + pre_init(); sub pre_init { @@ -205,10 +208,12 @@ sub init { reload_settings(); # make sure we redraw when necessary. - Irssi::signal_add('window changed', \&uberprompt_refresh); - Irssi::signal_add('window name changed', \&uberprompt_refresh); - Irssi::signal_add('window changed automatic', \&uberprompt_refresh); - Irssi::signal_add('window item changed', \&uberprompt_refresh); + Irssi::signal_add('window changed', \&uberprompt_refresh); + Irssi::signal_add('window name changed', \&uberprompt_refresh); + Irssi::signal_add('window changed automatic', \&uberprompt_refresh); + Irssi::signal_add('window item changed', \&uberprompt_refresh); + Irssi::signal_add('window item server changed', \&uberprompt_refresh); + Irssi::signal_add('window server changed', \&uberprompt_refresh); # install our statusbars if required. if (Irssi::settings_get_bool('uberprompt_autostart')) { @@ -252,6 +257,17 @@ sub reload_settings { $prompt_format = $new; $prompt_format =~ s/\$uber/\$\$uber/; Irssi::abstracts_register(['uberprompt', $prompt_format]); + + $expando_vars = {}; + + # TODO: something clever here to check if we need to schedule + # an update timer or something, rather than just refreshing on + # every possible activity in init() + while ($prompt_format =~ m/(?{$var_name} = Irssi::parse_special($1); + } } } -- cgit v1.2.3