diff options
author | Timo Sirainen <cras@irssi.org> | 2001-06-30 11:53:03 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-06-30 11:53:03 +0000 |
commit | 3005cad5c37962f788cfe12a19704f0483ae96b0 (patch) | |
tree | 3a53b3169604d7c1a2da13a75402ae4ccd9db52f | |
parent | e72780d4d6ab4e0486ead10dbab5c633602d4d5f (diff) | |
download | irssi-3005cad5c37962f788cfe12a19704f0483ae96b0.zip |
use Irssi; use Irssi::Irc and use Irssi::UI are now automatically called so
you won't need to add those to scripts.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1603 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/perl/perl-common.c | 8 | ||||
-rw-r--r-- | src/perl/perl.c | 10 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c index b004b9e6..781cd9b8 100644 --- a/src/perl/perl-common.c +++ b/src/perl/perl-common.c @@ -21,6 +21,7 @@ #include "module.h" #include "modules.h" #include "signals.h" +#include "core.h" #include "misc.h" #include "settings.h" @@ -156,6 +157,13 @@ char *perl_get_use_list(void) str = g_string_new(NULL); + if (*PERL_LIB_DIR != '\0') + g_string_append(str, "use lib \""PERL_LIB_DIR"\";"); + + g_string_append(str, "use Irssi;"); + if (irssi_gui != IRSSI_GUI_NONE) + g_string_append(str, "use Irssi::UI;"); + for (tmp = use_protocols; tmp != NULL; tmp = tmp->next) g_string_sprintfa(str, "use Irssi::%s;", (char *) tmp->data); diff --git a/src/perl/perl.c b/src/perl/perl.c index 4a766282..9fbab064 100644 --- a/src/perl/perl.c +++ b/src/perl/perl.c @@ -94,12 +94,12 @@ static void irssi_perl_start(void) perl_parse(my_perl, xs_init, 3, args, NULL); - use_code = *PERL_LIB_DIR == '\0' ? "" : - "use lib \""PERL_LIB_DIR"\";"; - + use_code = perl_get_use_list(); code = g_strdup_printf(eval_file_code, use_code); perl_eval_pv(code, TRUE); - g_free(code); + + g_free(code); + g_free(use_code); perl_common_init(); } @@ -249,7 +249,7 @@ static void cmd_perl(const char *data) code = g_string_new(NULL); uses = perl_get_use_list(); - g_string_sprintf(code, "sub { use Irssi;%s\n%s }", uses, data); + g_string_sprintf(code, "sub { %s\n%s }", uses, data); sv = perl_eval_pv(code->str, TRUE); perl_call_sv(sv, G_VOID|G_NOARGS|G_EVAL|G_DISCARD); |