diff --git a/src/perl/common/Channel.xs b/src/perl/common/Channel.xs index 4763e708..f425dc2b 100644 --- a/src/perl/common/Channel.xs +++ b/src/perl/common/Channel.xs @@ -9,7 +9,7 @@ PREINIT: GSList *tmp; PPCODE: for (tmp = channels; tmp != NULL; tmp = tmp->next) { - XPUSHs(sv_2mortal(irssi_bless((CHANNEL_REC *) tmp->data))); + XPUSHs(sv_2mortal(iobject_bless((CHANNEL_REC *) tmp->data))); } Irssi::Channel @@ -31,7 +31,7 @@ PREINIT: GSList *tmp; PPCODE: for (tmp = server->channels; tmp != NULL; tmp = tmp->next) { - XPUSHs(sv_2mortal(irssi_bless((CHANNEL_REC *) tmp->data))); + XPUSHs(sv_2mortal(iobject_bless((CHANNEL_REC *) tmp->data))); } void @@ -65,8 +65,8 @@ PPCODE: list = nicklist_get_same(server, nick); for (tmp = list; tmp != NULL; tmp = tmp->next->next) { - XPUSHs(sv_2mortal(irssi_bless((CHANNEL_REC *) tmp->data))); - XPUSHs(sv_2mortal(irssi_bless((NICK_REC *) tmp->next->data))); + XPUSHs(sv_2mortal(iobject_bless((CHANNEL_REC *) tmp->data))); + XPUSHs(sv_2mortal(iobject_bless((NICK_REC *) tmp->next->data))); } g_slist_free(list); @@ -119,6 +119,6 @@ PPCODE: list = nicklist_getnicks(channel); for (tmp = list; tmp != NULL; tmp = tmp->next) { - XPUSHs(sv_2mortal(irssi_bless((NICK_REC *) tmp->data))); + XPUSHs(sv_2mortal(iobject_bless((NICK_REC *) tmp->data))); } g_slist_free(list); diff --git a/src/perl/common/Query.xs b/src/perl/common/Query.xs index b0766b91..54a0582c 100644 --- a/src/perl/common/Query.xs +++ b/src/perl/common/Query.xs @@ -11,7 +11,7 @@ PPCODE: for (tmp = queries; tmp != NULL; tmp = tmp->next) { QUERY_REC *rec = tmp->data; - XPUSHs(sv_2mortal(irssi_bless(rec))); + XPUSHs(sv_2mortal(iobject_bless(rec))); } Irssi::Query @@ -35,7 +35,7 @@ PPCODE: for (tmp = server->queries; tmp != NULL; tmp = tmp->next) { QUERY_REC *rec = tmp->data; - XPUSHs(sv_2mortal(irssi_bless(rec))); + XPUSHs(sv_2mortal(iobject_bless(rec))); } Irssi::Query diff --git a/src/perl/common/Server.xs b/src/perl/common/Server.xs index 2bb992e9..1ae534cf 100644 --- a/src/perl/common/Server.xs +++ b/src/perl/common/Server.xs @@ -9,7 +9,7 @@ PREINIT: GSList *tmp; PPCODE: for (tmp = servers; tmp != NULL; tmp = tmp->next) { - XPUSHs(sv_2mortal(irssi_bless((SERVER_REC *) tmp->data))); + XPUSHs(sv_2mortal(iobject_bless((SERVER_REC *) tmp->data))); } void @@ -27,7 +27,7 @@ PREINIT: GSList *tmp; PPCODE: for (tmp = chatnets; tmp != NULL; tmp = tmp->next) { - XPUSHs(sv_2mortal(irssi_bless((CHATNET_REC *) tmp->data))); + XPUSHs(sv_2mortal(iobject_bless((CHATNET_REC *) tmp->data))); } Irssi::Connect diff --git a/src/perl/common/typemap b/src/perl/common/typemap index f7829f58..5b7e0c32 100644 --- a/src/perl/common/typemap +++ b/src/perl/common/typemap @@ -25,7 +25,7 @@ T_PlainObj OUTPUT T_IrssiObj - $arg = irssi_bless((SERVER_REC *)$var); + $arg = iobject_bless((SERVER_REC *)$var); T_PlainObj $arg = plain_bless($var, \"$type\"); diff --git a/src/perl/get-signals.pl b/src/perl/get-signals.pl index e4df4a51..df4667ce 100755 --- a/src/perl/get-signals.pl +++ b/src/perl/get-signals.pl @@ -39,7 +39,7 @@ while () { s/NETSPLIT_SERVER_REC[^,]*/Irssi::Irc::Netsplitserver/g; # irc modules - s/DCC_REC[^,]*/Irssi::Irc::Dcc/g; + s/DCC_REC[^,]*/siobject/g; s/AUTOIGNORE_REC[^,]*/Irssi::Irc::Autoignore/g; s/NOTIFYLIST_REC[^,]*/Irssi::Irc::Notifylist/g; diff --git a/src/perl/irc/Dcc.xs b/src/perl/irc/Dcc.xs index a46f171f..657783a7 100644 --- a/src/perl/irc/Dcc.xs +++ b/src/perl/irc/Dcc.xs @@ -9,7 +9,7 @@ PREINIT: GSList *tmp; PPCODE: for (tmp = dcc_conns; tmp != NULL; tmp = tmp->next) - XPUSHs(sv_2mortal(dcc_bless((DCC_REC *) tmp->data))); + XPUSHs(sv_2mortal(simple_iobject_bless((DCC_REC *) tmp->data))); void dcc_register_type(type) diff --git a/src/perl/irc/Irc.xs b/src/perl/irc/Irc.xs index 2f742fad..7b6d0ae5 100644 --- a/src/perl/irc/Irc.xs +++ b/src/perl/irc/Irc.xs @@ -28,12 +28,12 @@ static void perl_dcc_fill_hash(HV *hv, DCC_REC *dcc) hv_store(hv, "orig_type", 9, new_pv(dcc_type2str(dcc->orig_type)), 0); hv_store(hv, "created", 7, newSViv(dcc->created), 0); - hv_store(hv, "server", 6, irssi_bless(dcc->server), 0); + hv_store(hv, "server", 6, iobject_bless(dcc->server), 0); hv_store(hv, "servertag", 9, new_pv(dcc->servertag), 0); hv_store(hv, "mynick", 6, new_pv(dcc->mynick), 0); hv_store(hv, "nick", 4, new_pv(dcc->nick), 0); - hv_store(hv, "chat", 4, dcc_bless(dcc->chat), 0); + hv_store(hv, "chat", 4, simple_iobject_bless(dcc->chat), 0); hv_store(hv, "target", 6, new_pv(dcc->target), 0); hv_store(hv, "arg", 3, new_pv(dcc->arg), 0); @@ -110,7 +110,7 @@ static void perl_netsplit_server_fill_hash(HV *hv, NETSPLIT_SERVER_REC *rec) static void perl_netsplit_channel_fill_hash(HV *hv, NETSPLIT_CHAN_REC *rec) { hv_store(hv, "name", 4, new_pv(rec->name), 0); - hv_store(hv, "nick", 4, irssi_bless(&rec->nick), 0); + hv_store(hv, "nick", 4, iobject_bless(&rec->nick), 0); } static void perl_notifylist_fill_hash(HV *hv, NOTIFYLIST_REC *notify) diff --git a/src/perl/irc/module.h b/src/perl/irc/module.h index d90bb1bf..89aaff06 100644 --- a/src/perl/irc/module.h +++ b/src/perl/irc/module.h @@ -19,10 +19,6 @@ #include "dcc/dcc-send.h" #include "notifylist/notifylist.h" -#define dcc_bless(dcc) \ - ((dcc) == NULL ? &PL_sv_undef : \ - irssi_bless_iobject((dcc)->type, 0, dcc)) - typedef IRC_SERVER_REC *Irssi__Irc__Server; typedef IRC_SERVER_CONNECT_REC *Irssi__Irc__Connect; typedef IRC_CHANNEL_REC *Irssi__Irc__Channel; diff --git a/src/perl/irc/typemap b/src/perl/irc/typemap index 621cec1d..d5604a77 100644 --- a/src/perl/irc/typemap +++ b/src/perl/irc/typemap @@ -29,10 +29,10 @@ T_PlainObj OUTPUT T_IrssiObj - $arg = irssi_bless((SERVER_REC *)$var); + $arg = iobject_bless((SERVER_REC *)$var); T_DccObj - $arg = dcc_bless((DCC_REC *)$var); + $arg = simple_iobject_bless((DCC_REC *)$var); T_PlainObj $arg = plain_bless($var, \"$type\"); diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c index 96961cd8..8de38ad0 100644 --- a/src/perl/perl-common.c +++ b/src/perl/perl-common.c @@ -298,7 +298,7 @@ void perl_window_item_fill_hash(HV *hv, WI_ITEM_REC *item) hv_store(hv, "chat_type", 9, new_pv(chat_type), 0); if (item->server != NULL) { - hv_store(hv, "server", 6, irssi_bless(item->server), 0); + hv_store(hv, "server", 6, iobject_bless(item->server), 0); } hv_store(hv, "name", 4, new_pv(item->name), 0); diff --git a/src/perl/perl-common.h b/src/perl/perl-common.h index da099062..13ea3d4e 100644 --- a/src/perl/perl-common.h +++ b/src/perl/perl-common.h @@ -28,10 +28,14 @@ char *perl_function_get_package(const char *function); # define PL_sv_undef sv_undef #endif -#define irssi_bless(object) \ +#define iobject_bless(object) \ ((object) == NULL ? &PL_sv_undef : \ irssi_bless_iobject((object)->type, (object)->chat_type, object)) +#define simple_iobject_bless(object) \ + ((object) == NULL ? &PL_sv_undef : \ + irssi_bless_iobject((object)->type, 0, object)) + #define plain_bless(object, stash) \ ((object) == NULL ? &PL_sv_undef : \ irssi_bless_plain(stash, object)) diff --git a/src/perl/perl-signals.c b/src/perl/perl-signals.c index 3dd248fe..2d7940df 100644 --- a/src/perl/perl-signals.c +++ b/src/perl/perl-signals.c @@ -114,7 +114,7 @@ static void perl_call_signal(const char *func, int signal_id, ptr = arg; for (tmp = *ptr; tmp != NULL; tmp = tmp->next) { - sv = is_iobject ? irssi_bless((SERVER_REC *) tmp->data) : + sv = is_iobject ? iobject_bless((SERVER_REC *) tmp->data) : is_str ? new_pv(tmp->data) : irssi_bless_plain(rec->args[n]+9, tmp->data); av_push(av, sv); @@ -129,7 +129,7 @@ static void perl_call_signal(const char *func, int signal_id, is_iobject = strcmp(rec->args[n]+7, "iobject") == 0; av = newAV(); for (tmp = arg; tmp != NULL; tmp = tmp->next) { - sv = is_iobject ? irssi_bless((SERVER_REC *) tmp->data) : + sv = is_iobject ? iobject_bless((SERVER_REC *) tmp->data) : irssi_bless_plain(rec->args[n]+7, tmp->data); av_push(av, sv); } @@ -140,9 +140,13 @@ static void perl_call_signal(const char *func, int signal_id, perlarg = newSViv(0); } else if (strcmp(rec->args[n], "iobject") == 0) { /* "irssi object" - any struct that has - "int type; int chat_type" as its first + "int type; int chat_type" as it's first variables (server, channel, ..) */ - perlarg = irssi_bless((SERVER_REC *) arg); + perlarg = iobject_bless((SERVER_REC *) arg); + } else if (strcmp(rec->args[n], "siobject") == 0) { + /* "simple irssi object" - any struct that has + int type; as it's first variable (dcc) */ + perlarg = simple_iobject_bless((SERVER_REC *) arg); } else { /* blessed object */ perlarg = plain_bless(arg, rec->args[n]); diff --git a/src/perl/ui/UI.xs b/src/perl/ui/UI.xs index e1ed56b4..04fce9fe 100644 --- a/src/perl/ui/UI.xs +++ b/src/perl/ui/UI.xs @@ -28,9 +28,9 @@ static void perl_window_fill_hash(HV *hv, WINDOW_REC *window) hv_store(hv, "height", 6, newSViv(window->height), 0); if (window->active) - hv_store(hv, "active", 6, irssi_bless(window->active), 0); + hv_store(hv, "active", 6, iobject_bless(window->active), 0); if (window->active_server) - hv_store(hv, "active_server", 13, irssi_bless(window->active_server), 0); + hv_store(hv, "active_server", 13, iobject_bless(window->active_server), 0); hv_store(hv, "servertag", 9, new_pv(window->servertag), 0); hv_store(hv, "level", 5, newSViv(window->level), 0); @@ -50,7 +50,7 @@ static void perl_window_fill_hash(HV *hv, WINDOW_REC *window) static void perl_text_dest_fill_hash(HV *hv, TEXT_DEST_REC *dest) { hv_store(hv, "window", 6, plain_bless(dest->window, "Irssi::UI::Window"), 0); - hv_store(hv, "server", 6, irssi_bless(dest->server), 0); + hv_store(hv, "server", 6, iobject_bless(dest->server), 0); hv_store(hv, "target", 6, new_pv(dest->target), 0); hv_store(hv, "level", 5, newSViv(dest->level), 0); diff --git a/src/perl/ui/Window.xs b/src/perl/ui/Window.xs index afe523c4..debc767c 100644 --- a/src/perl/ui/Window.xs +++ b/src/perl/ui/Window.xs @@ -150,7 +150,7 @@ PPCODE: for (tmp = window->items; tmp != NULL; tmp = tmp->next) { CHANNEL_REC *rec = tmp->data; - XPUSHs(sv_2mortal(irssi_bless(rec))); + XPUSHs(sv_2mortal(iobject_bless(rec))); } void