1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Irssi::signal_emit() was broken.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1027 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-12-29 19:22:00 +00:00 committed by cras
parent 84d672ee42
commit e50535a64e
3 changed files with 22 additions and 1 deletions

View File

@ -11,7 +11,12 @@ CODE:
memset(p, 0, sizeof(p));
for (n = 1; n < items && n < 7; n++) {
p[n-1] = SvPOKp(ST(n)) ? SvPV(ST(n), n_a) : (void *) SvIV((SV*)SvRV(ST(n)));
if (SvPOKp(ST(n)))
p[n-1] = SvPV(ST(n), n_a);
else if (irssi_is_ref_object(ST(n)))
p[n-1] = irssi_ref_object(ST(n));
else
p[n-1] = (void *) SvIV((SV*)SvRV(ST(n)));
}
signal_emit(signal, items-1, p[0], p[1], p[2], p[3], p[4], p[5], p[6]);

View File

@ -96,6 +96,21 @@ SV *irssi_bless_plain(const char *stash, void *object)
return sv_bless(newRV_noinc((SV*)hv), gv_stashpv((char *)stash, 1));
}
int irssi_is_ref_object(SV *o)
{
SV **sv;
HV *hv;
hv = hvref(o);
if (hv != NULL) {
sv = hv_fetch(hv, "_irssi", 6, 0);
if (sv != NULL)
return TRUE;
}
return FALSE;
}
void *irssi_ref_object(SV *o)
{
SV **sv;

View File

@ -32,6 +32,7 @@ char *perl_get_package(void);
irssi_bless_iobject((object)->type, (object)->chat_type, object))
SV *irssi_bless_iobject(int type, int chat_type, void *object);
SV *irssi_bless_plain(const char *stash, void *object);
int irssi_is_ref_object(SV *o);
void *irssi_ref_object(SV *o);
void irssi_add_object(int type, int chat_type, const char *stash,