aboutsummaryrefslogtreecommitdiffstats
path: root/feature-tests
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2011-11-25 02:48:28 +0000
committerTom Feist <shabble@metavore.org>2011-11-25 02:48:28 +0000
commit1554c2aec40f6265d87622fc858bf710b909cc10 (patch)
tree6b582968e8344abfadcb71f8ac32e072749d4ab0 /feature-tests
parentadded growl_notify, as a stub for the growl notification interface (diff)
downloadirssi-scripts-1554c2aec40f6265d87622fc858bf710b909cc10.tar.gz
irssi-scripts-1554c2aec40f6265d87622fc858bf710b909cc10.zip
update template with some generic debugging features.
Diffstat (limited to '')
-rw-r--r--feature-tests/template.pl32
1 files changed, 32 insertions, 0 deletions
diff --git a/feature-tests/template.pl b/feature-tests/template.pl
index a49d742..a5f59fa 100644
--- a/feature-tests/template.pl
+++ b/feature-tests/template.pl
@@ -67,3 +67,35 @@ our %IRSSI = (
license => 'MIT',
updated => '$DATE'
);
+
+my $NAME = $IRSSI{name};
+my $DEBUG = 0;
+
+sub DEBUG () { $DEBUG }
+
+sub _debug_print {
+ my ($msg) = @_;
+ Irssi::active_window()->print($msg);
+}
+
+sub sig_setup_changed {
+ $DEBUG = Irssi::settings_get_bool($NAME . '_debug');
+ _debug_print($NAME . ': debug enabled') if $DEBUG;
+}
+
+sub init {
+ Irssi::theme_register
+ ([
+ verbatim => '[$*]',
+ script_loaded => 'Loaded script {hilight $0} v$1',
+ ]);
+ Irssi::settings_add_bool($NAME, $NAME . '_debug', 0);
+ Irssi::signal_add('setup changed', \&sig_setup_changed);
+
+ sig_setup_changed();
+
+ Irssi::printformat(Irssi::MSGLEVEL_CLIENTCRAP,
+ 'script_loaded', $NAME, $VERSION);
+}
+
+init();