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
This commit is contained in:
Timo Sirainen 2002-12-28 15:25:10 +00:00 committed by cras
commit 9c18cb00e7
3 changed files with 87 additions and 20 deletions

View file

@ -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
#*******************************