summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-12-29 19:22:00 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-12-29 19:22:00 +0000
commite50535a64e5a09066af9f10a2ac7177726502b1b (patch)
tree69b7734f5c7fd416186734c7de6f6fcbb97925a8 /src
parent84d672ee42778f4c92f577bfdf89c48d77ce3656 (diff)
downloadirssi-e50535a64e5a09066af9f10a2ac7177726502b1b.zip
Irssi::signal_emit() was broken.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1027 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/perl/common/Core.xs7
-rw-r--r--src/perl/perl-common.c15
-rw-r--r--src/perl/perl-common.h1
3 files changed, 22 insertions, 1 deletions
diff --git a/src/perl/common/Core.xs b/src/perl/common/Core.xs
index cef0ff24..1f8993e9 100644
--- a/src/perl/common/Core.xs
+++ b/src/perl/common/Core.xs
@@ -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]);
diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c
index 35b83828..12c7b93c 100644
--- a/src/perl/perl-common.c
+++ b/src/perl/perl-common.c
@@ -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;
diff --git a/src/perl/perl-common.h b/src/perl/perl-common.h
index 06f085a6..d8774090 100644
--- a/src/perl/perl-common.h
+++ b/src/perl/perl-common.h
@@ -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,