mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
"return 1" doesn't anymore stop signals in perl scripts. Fixed
Irssi::signal_stop() to properly stop the signal from going to other perl scripts. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1086 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
a2d9661982
commit
14dbcd00bf
@ -318,6 +318,17 @@ int signal_get_emitted_id(void)
|
||||
return rec->id;
|
||||
}
|
||||
|
||||
/* return TRUE if specified signal was stopped */
|
||||
int signal_is_stopped(int signal_id)
|
||||
{
|
||||
SIGNAL_REC *rec;
|
||||
|
||||
rec = g_hash_table_lookup(signals, GINT_TO_POINTER(signal_id));
|
||||
g_return_val_if_fail(rec != NULL, FALSE);
|
||||
|
||||
return rec->emitting <= rec->stop_emit;
|
||||
}
|
||||
|
||||
static void signal_remove_module(void *signal, SIGNAL_REC *rec,
|
||||
const char *module)
|
||||
{
|
||||
|
@ -42,6 +42,8 @@ void signal_stop_by_name(const char *signal);
|
||||
const char *signal_get_emitted(void);
|
||||
/* return the ID of the signal that is currently being emitted */
|
||||
int signal_get_emitted_id(void);
|
||||
/* return TRUE if specified signal was stopped */
|
||||
int signal_is_stopped(int signal_id);
|
||||
|
||||
/* remove all signals that belong to `module' */
|
||||
void signals_remove_module(const char *module);
|
||||
|
@ -49,7 +49,7 @@ static PERL_SIGNAL_ARGS_REC *perl_signal_args_find(int signal_id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int perl_call_signal(const char *func, int signal_id,
|
||||
static void perl_call_signal(const char *func, int signal_id,
|
||||
gconstpointer *args)
|
||||
{
|
||||
dSP;
|
||||
@ -106,28 +106,18 @@ static int perl_call_signal(const char *func, int signal_id,
|
||||
}
|
||||
|
||||
PUTBACK;
|
||||
retcount = perl_call_pv((char *) func, G_EVAL|G_SCALAR);
|
||||
retcount = perl_call_pv((char *) func, G_EVAL|G_DISCARD);
|
||||
SPAGAIN;
|
||||
|
||||
ret = 0;
|
||||
if (SvTRUE(ERRSV)) {
|
||||
STRLEN n_a;
|
||||
|
||||
signal_emit("gui dialog", 2, "error", SvPV(ERRSV, n_a));
|
||||
(void)POPs;
|
||||
} else if (retcount > 0) {
|
||||
SV *sv = POPs;
|
||||
|
||||
if (SvIOK(sv) && SvIV(sv) == 1) ret = 1;
|
||||
while (--retcount > 0)
|
||||
(void)POPi;
|
||||
}
|
||||
|
||||
PUTBACK;
|
||||
FREETMPS;
|
||||
LEAVE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void sig_func(int priority, gconstpointer *args)
|
||||
@ -141,12 +131,11 @@ static void sig_func(int priority, gconstpointer *args)
|
||||
for (tmp = list == NULL ? NULL : *list; tmp != NULL; tmp = tmp->next) {
|
||||
PERL_SIGNAL_REC *rec = tmp->data;
|
||||
|
||||
if (perl_call_signal(rec->func, signal_id, args)) {
|
||||
signal_stop();
|
||||
perl_call_signal(rec->func, signal_id, args);
|
||||
if (signal_is_stopped(signal_id))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define SIG_FUNC_DECL(priority, priority_name) \
|
||||
static void sig_func_##priority_name(gconstpointer p1, gconstpointer p2, \
|
||||
|
@ -317,7 +317,7 @@ static int perl_source_event(PERL_SOURCE_REC *rec)
|
||||
XPUSHs(sv_2mortal(new_pv(rec->data)));
|
||||
PUTBACK;
|
||||
|
||||
retcount = perl_call_pv(rec->func, G_EVAL|G_SCALAR);
|
||||
retcount = perl_call_pv(rec->func, G_EVAL|G_DISCARD);
|
||||
SPAGAIN;
|
||||
|
||||
if (SvTRUE(ERRSV)) {
|
||||
|
Loading…
Reference in New Issue
Block a user