From 9c18cb00e7d096e46f5853f802724da4c59c2857 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 28 Dec 2002 15:25:10 +0000 Subject: Added support to define new default abstracts at runtime. Irssi::abstracts_register([key => value, ...]); git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3079 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/perl/ui/Themes.xs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/perl/ui') diff --git a/src/perl/ui/Themes.xs b/src/perl/ui/Themes.xs index 7f1c5277..8aa30410 100644 --- a/src/perl/ui/Themes.xs +++ b/src/perl/ui/Themes.xs @@ -136,6 +136,31 @@ CODE: printformat_perl(&dest, format, arglist); +void +abstracts_register(SV *abstracts) +PREINIT: + AV *av; + char *key, *value; + int i, len; +CODE: + if (!SvROK(abstracts)) + croak("abstracts is not a reference to list"); + av = (AV *) SvRV(abstracts); + len = av_len(av)+1; + if (len == 0 || (len & 1) != 0) + croak("abstracts list is invalid - not divisible by 2 (%d)", len); + + for (i = 0; i < len; i++) { + key = SvPV(*av_fetch(av, i, 0), PL_na); i++; + value = SvPV(*av_fetch(av, i, 0), PL_na); + + theme_set_default_abstract(key, value); + } + themes_reload(); + +void +themes_reload() + #******************************* MODULE = Irssi::UI::Themes PACKAGE = Irssi::Server #******************************* -- cgit debian/1.2.3+git2.25.1-1-2-gaceb0