1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-27 05:20:20 -04:00

Irssi::Irc::Dcc::* is now correctly blessed instead of using Irssi::Irc::Dcc

always. did s/irssi_bless/iobject_bless/, added simple_iobject_bless which
DCC uses.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2092 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-11-19 19:36:21 +00:00 committed by cras
parent 99a6a85b85
commit 3819189ef4
14 changed files with 35 additions and 31 deletions

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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\");

View File

@ -39,7 +39,7 @@ while (<STDIN>) {
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;

View File

@ -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)

View File

@ -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)

View File

@ -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;

View File

@ -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\");

View File

@ -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);

View File

@ -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))

View File

@ -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]);

View File

@ -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);

View File

@ -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