summaryrefslogtreecommitdiff
path: root/src/perl
diff options
context:
space:
mode:
Diffstat (limited to 'src/perl')
-rw-r--r--src/perl/Makefile.am14
-rw-r--r--src/perl/Makefile_silent.pm76
-rw-r--r--src/perl/common/Expando.xs11
-rw-r--r--src/perl/common/Makefile.PL.in2
-rw-r--r--src/perl/irc/Irc.xs4
-rw-r--r--src/perl/irc/Makefile.PL.in2
-rw-r--r--src/perl/perl-core.c2
-rw-r--r--src/perl/perl-core.h2
-rw-r--r--src/perl/perl-fe.c13
-rw-r--r--src/perl/perl-signals.c5
-rw-r--r--src/perl/textui/Makefile.PL.in2
-rw-r--r--src/perl/textui/Statusbar.xs5
-rw-r--r--src/perl/ui/Makefile.PL.in2
13 files changed, 125 insertions, 15 deletions
diff --git a/src/perl/Makefile.am b/src/perl/Makefile.am
index a09c49a5..427c5492 100644
--- a/src/perl/Makefile.am
+++ b/src/perl/Makefile.am
@@ -117,16 +117,26 @@ textui_sources = \
EXTRA_DIST = \
get-signals.pl \
irssi-core.pl \
+ Makefile_silent.pm \
$(common_sources) \
$(irc_sources) \
$(ui_sources) \
$(textui_sources)
+am_v_pl__show_gen = $(am__v_pl__show_gen_$(V))
+am_v_pl__hide_gen = $(am__v_pl__hide_gen_$(V))
+am__v_pl__show_gen_ = $(am__v_pl__show_gen_$(AM_DEFAULT_VERBOSITY))
+am__v_pl__hide_gen_ = $(am__v_pl__hide_gen_$(AM_DEFAULT_VERBOSITY))
+am__v_pl__show_gen_0 = echo " GEN " $$dir ;
+am__v_pl__hide_gen_0 = > /dev/null
+am__v_pl__show_gen_1 =
+am__v_pl__hide_gen_1 =
+
all-local:
- for dir in $(perl_dirs); do \
+ $(AM_V_GEN)for dir in $(perl_dirs); do \
cd $$dir && \
if [ ! -f Makefile ]; then \
- $(perlpath) Makefile.PL $(PERL_MM_PARAMS); \
+ $(am_v_pl__show_gen)$(perlpath) Makefile.PL $(PERL_MM_PARAMS) $(am_v_pl__hide_gen); \
fi && \
($(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS) || \
$(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS)) && \
diff --git a/src/perl/Makefile_silent.pm b/src/perl/Makefile_silent.pm
new file mode 100644
index 00000000..b5d71d66
--- /dev/null
+++ b/src/perl/Makefile_silent.pm
@@ -0,0 +1,76 @@
+push @ExtUtils::MakeMaker::Overridable, qw(pm_to_blib);
+my $verb = $AM_DEFAULT_VERBOSITY;
+{ package MY;
+ sub _center {
+ my $z = shift;
+ (length $z == 2 ? " $z " : length $z == 4 ? " $z " : " $z ").' '
+ }
+ sub _silent_cmd {
+ my $z = shift;
+ $z =~ s{\t(?:- ?)?\K(?=\$\((?|(CC)CMD|(XS)UBPPRUN|(LD|MV|CHMOD)|(RM)_R?F|(CP)_NONEMPTY|FULL_(AR)\)))}{\$(PL_AM_V_$1)}g;
+ $z
+ }
+ sub c_o { _silent_cmd(shift->SUPER::c_o(@_)) }
+ sub xs_c { _silent_cmd(shift->SUPER::xs_c(@_)) }
+ sub xs_o { _silent_cmd(shift->SUPER::xs_o(@_)) }
+ sub dynamic_lib { _silent_cmd(shift->SUPER::dynamic_lib(@_)) }
+ sub static_lib { _silent_cmd(shift->SUPER::static_lib(@_)) }
+ sub dynamic_bs {
+ my $ret = shift->SUPER::dynamic_bs(@_);
+ $ret =~ s{Running Mkbootstrap for}{\$(PL_AM_V_BS_Text)}g;
+ _silent_cmd($ret)
+ }
+ sub pm_to_blib {
+ my $ret = shift->SUPER::pm_to_blib(@_);
+ $ret =~ s{^(\t(?:- ?)?)(?:\$\(NOECHO\) ?)?(.*-e ['"]pm_to_blib(.*\\\n)*.*)$}{$1\$(PL_AM_V_BLIB)$2\$(PL_AM_V_BLIB_Hide)}mg;
+ $ret
+ }
+ sub post_constants {
+ my $ret = shift->SUPER::post_constants(@_);
+ my @terse = qw(cc xs ld chmod cp ar blib);
+ my @silent = qw(mv rm);
+ my @special = qw(BLIB_Hide);
+
+ #default verbosity from command line parameter
+ $ret .= "
+AM_DEFAULT_VERBOSITY = @{[$verb ? 1 : 0]}
+";
+ #default options forward
+ $ret .= "
+PL_AM_V_${_} = \$(pl_am__v_${_}_\$(V))
+pl_am__v_${_}_ = \$(pl_am__v_${_}_\$(AM_DEFAULT_VERBOSITY))
+" for @special, map uc, @terse, @silent;
+
+ #quoted plain text needs extra quotes
+ $ret .= "
+PL_AM_V_BS_Text = \"\$(pl_am__v_BS_Text_\$(V))\"
+pl_am__v_BS_Text_ = \$(pl_am__v_BS_Text_\$(AM_DEFAULT_VERBOSITY))
+"
+ #hide pm_to_blib output
+. "
+pl_am__v_BLIB_Hide_0 = \$(DEV_NULL)
+pl_am__v_BLIB_Hide_1 =
+"
+ #text for Mkbootstrap
+. "
+pl_am__v_BS_Text_0 = \"@{[_center('BS')]}\"
+pl_am__v_BS_Text_1 = \"Running Mkbootstrap for\"
+";
+ #"terse" output
+ $ret .= "
+pl_am__v_${_}_0 = \$(NOECHO)echo \"@{[_center($_)]}\" \$\@;
+" for map uc, @terse;
+
+ #no output
+ $ret .= "
+pl_am__v_${_}_0 = \$(NOECHO)
+" for map uc, @silent;
+
+ #in verbose mode the "terse" echo expands to nothing
+ $ret .= "
+pl_am__v_${_}_1 =
+" for map uc, @terse, @silent;
+ $ret
+ }
+}
+1;
diff --git a/src/perl/common/Expando.xs b/src/perl/common/Expando.xs
index e8e8f751..26800b05 100644
--- a/src/perl/common/Expando.xs
+++ b/src/perl/common/Expando.xs
@@ -74,15 +74,20 @@ static char *perl_expando_event(PerlExpando *rec, SERVER_REC *server,
ret = NULL;
if (SvTRUE(ERRSV)) {
+ PERL_SCRIPT_REC *script = rec->script;
+
(void) POPs;
/* call putback before emitting script error signal as that
* could manipulate the perl stack. */
PUTBACK;
/* make sure we don't get back here */
- if (rec->script != NULL)
- script_unregister_expandos(rec->script);
+ if (script != NULL)
+ script_unregister_expandos(script);
+ /* rec has been freed now */
- signal_emit("script error", 2, rec->script, SvPV_nolen(ERRSV));
+ char *error = g_strdup(SvPV_nolen(ERRSV));
+ signal_emit("script error", 2, script, error);
+ g_free(error);
} else if (retcount > 0) {
ret = g_strdup(POPp);
*free_ret = TRUE;
diff --git a/src/perl/common/Makefile.PL.in b/src/perl/common/Makefile.PL.in
index 4e545e7c..84a80403 100644
--- a/src/perl/common/Makefile.PL.in
+++ b/src/perl/common/Makefile.PL.in
@@ -1,4 +1,4 @@
-use ExtUtils::MakeMaker;
+use ExtUtils::MakeMaker;our $AM_DEFAULT_VERBOSITY='@AM_DEFAULT_VERBOSITY@';require "../Makefile_silent.pm";
WriteMakefile('NAME' => 'Irssi',
'LIBS' => '',
diff --git a/src/perl/irc/Irc.xs b/src/perl/irc/Irc.xs
index db5c5f79..3f8ccc2e 100644
--- a/src/perl/irc/Irc.xs
+++ b/src/perl/irc/Irc.xs
@@ -149,14 +149,14 @@ static void perl_notifylist_fill_hash(HV *hv, NOTIFYLIST_REC *notify)
static void perl_client_fill_hash(HV *hv, CLIENT_REC *client)
{
(void) hv_store(hv, "nick", 4, new_pv(client->nick), 0);
- (void) hv_store(hv, "host", 4, new_pv(client->host), 0);
- (void) hv_store(hv, "port", 4, newSViv(client->port), 0);
+ (void) hv_store(hv, "addr", 4, new_pv(client->addr), 0);
(void) hv_store(hv, "proxy_address", 13, new_pv(client->proxy_address), 0);
(void) hv_store(hv, "server", 6, iobject_bless(client->server), 0);
(void) hv_store(hv, "pass_sent", 9, newSViv(client->pass_sent), 0);
(void) hv_store(hv, "user_sent", 9, newSViv(client->user_sent), 0);
(void) hv_store(hv, "connected", 9, newSViv(client->connected), 0);
(void) hv_store(hv, "want_ctcp", 9, newSViv(client->want_ctcp), 0);
+ (void) hv_store(hv, "multiplex", 9, newSViv(client->multiplex), 0);
(void) hv_store(hv, "ircnet", 6, new_pv(client->listen->ircnet), 0);
}
diff --git a/src/perl/irc/Makefile.PL.in b/src/perl/irc/Makefile.PL.in
index 8f1e94d5..0fbc5241 100644
--- a/src/perl/irc/Makefile.PL.in
+++ b/src/perl/irc/Makefile.PL.in
@@ -1,4 +1,4 @@
-use ExtUtils::MakeMaker;
+use ExtUtils::MakeMaker;our $AM_DEFAULT_VERBOSITY='@AM_DEFAULT_VERBOSITY@';require "../Makefile_silent.pm";
WriteMakefile('NAME' => 'Irssi::Irc',
'LIBS' => '',
diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c
index cb690906..2c61df70 100644
--- a/src/perl/perl-core.c
+++ b/src/perl/perl-core.c
@@ -393,7 +393,7 @@ int perl_get_api_version(void)
return IRSSI_PERL_API_VERSION;
}
-static void perl_scripts_autorun(void)
+void perl_scripts_autorun(void)
{
DIR *dirp;
struct dirent *dp;
diff --git a/src/perl/perl-core.h b/src/perl/perl-core.h
index b451cc5c..7390a6fd 100644
--- a/src/perl/perl-core.h
+++ b/src/perl/perl-core.h
@@ -16,6 +16,8 @@ extern GSList *perl_scripts;
void perl_scripts_init(void);
/* Destroy all perl scripts and deinitialize perl interpreter */
void perl_scripts_deinit(void);
+/* Load all the scripts in the autorun/ folder */
+void perl_scripts_autorun(void);
/* Load a perl script, path must be a full path. */
PERL_SCRIPT_REC *perl_script_load_file(const char *path);
diff --git a/src/perl/perl-fe.c b/src/perl/perl-fe.c
index 04305b63..396c80b7 100644
--- a/src/perl/perl-fe.c
+++ b/src/perl/perl-fe.c
@@ -119,8 +119,20 @@ static void cmd_script_unload(const char *data)
static void cmd_script_reset(const char *data)
{
+ void *free_arg;
+ GHashTable *optlist;
+
+ if (!cmd_get_params(data, &free_arg, 0 | PARAM_FLAG_OPTIONS,
+ "script reset", &optlist))
+ return;
+
perl_scripts_deinit();
perl_scripts_init();
+
+ if (g_hash_table_lookup(optlist, "autorun") != NULL)
+ perl_scripts_autorun();
+
+ cmd_params_free(free_arg);
}
static void cmd_script_list(void)
@@ -251,6 +263,7 @@ void fe_perl_init(void)
command_bind("script list", NULL, (SIGNAL_FUNC) cmd_script_list);
command_bind("load", NULL, (SIGNAL_FUNC) cmd_load);
command_set_options("script exec", "permanent");
+ command_set_options("script reset", "autorun");
signal_add("script error", (SIGNAL_FUNC) sig_script_error);
signal_add("complete command script load", (SIGNAL_FUNC) sig_complete_load);
diff --git a/src/perl/perl-signals.c b/src/perl/perl-signals.c
index 007f7ad5..8f993660 100644
--- a/src/perl/perl-signals.c
+++ b/src/perl/perl-signals.c
@@ -433,8 +433,9 @@ static void perl_signal_remove_list_one(GSList **siglist, PERL_SIGNAL_REC *rec)
}
#define sv_func_cmp(f1, f2) \
- (f1 == f2 || (SvPOK(f1) && SvPOK(f2) && \
- g_strcmp0(SvPV_nolen(f1), SvPV_nolen(f2)) == 0))
+ ((SvROK(f1) && SvROK(f2) && SvRV(f1) == SvRV(f2)) || \
+ (SvPOK(f1) && SvPOK(f2) && \
+ g_strcmp0(SvPV_nolen(f1), SvPV_nolen(f2)) == 0))
static void perl_signal_remove_list(GSList **list, SV *func)
{
diff --git a/src/perl/textui/Makefile.PL.in b/src/perl/textui/Makefile.PL.in
index 9e80274b..3541f75c 100644
--- a/src/perl/textui/Makefile.PL.in
+++ b/src/perl/textui/Makefile.PL.in
@@ -1,4 +1,4 @@
-use ExtUtils::MakeMaker;
+use ExtUtils::MakeMaker;our $AM_DEFAULT_VERBOSITY='@AM_DEFAULT_VERBOSITY@';require "../Makefile_silent.pm";
WriteMakefile('NAME' => 'Irssi::TextUI',
'LIBS' => '',
diff --git a/src/perl/textui/Statusbar.xs b/src/perl/textui/Statusbar.xs
index a449e11d..8b0e5f65 100644
--- a/src/perl/textui/Statusbar.xs
+++ b/src/perl/textui/Statusbar.xs
@@ -77,7 +77,10 @@ static void perl_statusbar_event(char *function, SBAR_ITEM_REC *item,
/* make sure we don't get back here */
script_unregister_statusbars(script);
}
- signal_emit("script error", 2, script, SvPV_nolen(ERRSV));
+
+ char *error = g_strdup(SvPV_nolen(ERRSV));
+ signal_emit("script error", 2, script, error);
+ g_free(error);
} else {
/* min_size and max_size can be changed, move them to SBAR_ITEM_REC */
hv = hvref(item_sv);
diff --git a/src/perl/ui/Makefile.PL.in b/src/perl/ui/Makefile.PL.in
index a349918e..ed87d528 100644
--- a/src/perl/ui/Makefile.PL.in
+++ b/src/perl/ui/Makefile.PL.in
@@ -1,4 +1,4 @@
-use ExtUtils::MakeMaker;
+use ExtUtils::MakeMaker;our $AM_DEFAULT_VERBOSITY='@AM_DEFAULT_VERBOSITY@';require "../Makefile_silent.pm";
WriteMakefile('NAME' => 'Irssi::UI',
'LIBS' => '',