> Timo: can you please explain a bit how the perl plugin works? i really
> don't understand the code in perl-common.c with all the blessing and
> stuff. i'm trying to write a tcl plugin but don't really know how to
> start...

The blessing stuff is required only to make it work well with Perl. For
TCL plugin you'd probably do things in this order:

 - Figure out how to run TCL code from irssi. Just make some /TCLRUN
command which loads the specified file and runs it in TCL interpreter.

 - Figure out how to call C functions (irssi functions) from TCL.

 - Figure out how to handle the server, channel, etc. structures easily
with TCL. The blessing stuff in perl is for this, I'm not sure if it's
possible with TCL easily. With perl you can for example get the nick in
some server with $server->{nick}. I've never used TCL but something
like server[nick] might be possible with it too (does it have hashs?
structures?). If nothing like this is possible, the alternative would
be to creates lots and lots of functions like server_get_nick(),
server_get_tag(), channel_get_name(), channel_get_nicks(), etc. etc. I
don't think that's as easy. You only need to extract information from C
structs, not to be able to modify it in TCL.

 - Make the signaling system work in scripts. Most of this code can be
taken from Perl plugin I think. Mostly you just need to be able to call
a specified function in TCL code from C.

Once you get all of these to work somehow, write lots and lots of
wrappers for irssi's C functions so they can be called from TCL (the
same as *.xs files have in Perl).

Reply via email to