diff options
author | Timo Sirainen <cras@irssi.org> | 2001-02-20 02:37:01 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-02-20 02:37:01 +0000 |
commit | 2aeb9259e005635d0ee76e489d62d173623f6fb3 (patch) | |
tree | 9ba2fe9543c448d24fe308406ecda22766c6160d /src/perl/irc | |
parent | 7a6c3f0b7c98c380e2225c358020704bdad73fa7 (diff) | |
download | irssi-2aeb9259e005635d0ee76e489d62d173623f6fb3.zip |
DCC updates
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1267 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/perl/irc')
-rw-r--r-- | src/perl/irc/Dcc.xs | 66 | ||||
-rw-r--r-- | src/perl/irc/Irc.xs | 45 | ||||
-rw-r--r-- | src/perl/irc/module.h | 8 | ||||
-rw-r--r-- | src/perl/irc/typemap | 11 |
4 files changed, 122 insertions, 8 deletions
diff --git a/src/perl/irc/Dcc.xs b/src/perl/irc/Dcc.xs index f65d2c70..8b6d7155 100644 --- a/src/perl/irc/Dcc.xs +++ b/src/perl/irc/Dcc.xs @@ -4,12 +4,29 @@ void dccs() PREINIT: GSList *tmp; - HV *stash; PPCODE: - stash = gv_stashpv("Irssi::Irc::Dcc", 0); - for (tmp = dcc_conns; tmp != NULL; tmp = tmp->next) { - push_bless(tmp->data, stash); - } + for (tmp = dcc_conns; tmp != NULL; tmp = tmp->next) + XPUSHs(sv_2mortal(dcc_bless((DCC_REC *) tmp->data))); + +void +dcc_register_type(type) + char *type + +void +dcc_unregister_type(type) + char *type + +int +dcc_str2type(str) + char *str + +char * +dcc_type2str(type) + int type +CODE: + RETVAL = (char *) module_find_id_str("DCC", type); +OUTPUT: + RETVAL Irssi::Irc::Dcc dcc_find_request_latest(type) @@ -21,6 +38,23 @@ dcc_find_request(type, nick, arg) char *nick char *arg +Irssi::Irc::Dcc::Chat +dcc_chat_find_id(id) + char *id + +void +dcc_chat_send(dcc, data) + Irssi::Irc::Dcc::Chat dcc + char *data + +void +dcc_ctcp_message(server, target, chat, notice, msg) + Irssi::Irc::Server server + char *target + Irssi::Irc::Dcc::Chat chat + int notice + char *msg + char * dcc_get_download_path(fname) char *fname @@ -30,10 +64,30 @@ MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Dcc PREFIX = dcc_ #******************************* void +dcc_init_rec(dcc, server, chat, nick, arg) + Irssi::Irc::Dcc dcc + Irssi::Irc::Server server + Irssi::Irc::Dcc::Chat chat + char *nick + char *arg + +void dcc_destroy(dcc) Irssi::Irc::Dcc dcc -void +void +dcc_close(dcc) + Irssi::Irc::Dcc dcc + +void dcc_reject(dcc, server) Irssi::Irc::Dcc dcc Irssi::Irc::Server server + +#******************************* +MODULE = Irssi::Irc PACKAGE = Irssi::Windowitem PREFIX = item_ +#******************************* + +Irssi::Irc::Dcc::Chat +item_get_dcc(item) + Irssi::Windowitem item diff --git a/src/perl/irc/Irc.xs b/src/perl/irc/Irc.xs index ba9f9f20..37303ebb 100644 --- a/src/perl/irc/Irc.xs +++ b/src/perl/irc/Irc.xs @@ -26,6 +26,8 @@ static void perl_dcc_fill_hash(HV *hv, DCC_REC *dcc) { HV *stash; + hv_store(hv, "type", 4, new_pv(dcc_type2str(dcc->type)), 0); + 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); @@ -33,7 +35,7 @@ static void perl_dcc_fill_hash(HV *hv, DCC_REC *dcc) hv_store(hv, "mynick", 6, new_pv(dcc->mynick), 0); hv_store(hv, "nick", 4, new_pv(dcc->nick), 0); - stash = gv_stashpv("Irssi::Irc::Dcc", 0); + stash = gv_stashpv("Irssi::Irc::Dcc::Chat", 0); hv_store(hv, "chat", 4, new_bless(dcc->chat, stash), 0); hv_store(hv, "target", 6, new_pv(dcc->target), 0); hv_store(hv, "arg", 3, new_pv(dcc->arg), 0); @@ -45,6 +47,33 @@ static void perl_dcc_fill_hash(HV *hv, DCC_REC *dcc) hv_store(hv, "transfd", 7, newSViv(dcc->transfd), 0); } +static void perl_dcc_chat_fill_hash(HV *hv, CHAT_DCC_REC *dcc) +{ + perl_dcc_fill_hash(hv, (DCC_REC *) dcc); + + hv_store(hv, "id", 2, new_pv(dcc->id), 0); + hv_store(hv, "mirc_ctcp", 9, newSViv(dcc->mirc_ctcp), 0); + hv_store(hv, "connection_lost", 15, newSViv(dcc->connection_lost), 0); +} + +static void perl_dcc_get_fill_hash(HV *hv, GET_DCC_REC *dcc) +{ + perl_dcc_fill_hash(hv, (DCC_REC *) dcc); + + hv_store(hv, "get_type", 8, newSViv(dcc->get_type), 0); + hv_store(hv, "file", 4, new_pv(dcc->file), 0); + hv_store(hv, "file_quoted", 11, newSViv(dcc->file_quoted), 0); +} + +static void perl_dcc_send_fill_hash(HV *hv, SEND_DCC_REC *dcc) +{ + perl_dcc_fill_hash(hv, (DCC_REC *) dcc); + + hv_store(hv, "file_quoted", 11, newSViv(dcc->file_quoted), 0); + hv_store(hv, "waitforend", 10, newSViv(dcc->waitforend), 0); + hv_store(hv, "gotalldata", 10, newSViv(dcc->gotalldata), 0); +} + static void perl_netsplit_fill_hash(HV *hv, NETSPLIT_REC *netsplit) { AV *av; @@ -135,8 +164,22 @@ CODE: irssi_add_object(module_get_uniq_id("SERVER", 0), chat_type, "Irssi::Irc::Server", (PERL_OBJECT_FUNC) perl_irc_server_fill_hash); + irssi_add_object(module_get_uniq_id_str("DCC", "CHAT"), + 0, "Irssi::Irc::Dcc::Chat", + (PERL_OBJECT_FUNC) perl_dcc_chat_fill_hash); + irssi_add_object(module_get_uniq_id_str("DCC", "GET"), + 0, "Irssi::Irc::Dcc::Get", + (PERL_OBJECT_FUNC) perl_dcc_get_fill_hash); + irssi_add_object(module_get_uniq_id_str("DCC", "SEND"), + 0, "Irssi::Irc::Dcc::Send", + (PERL_OBJECT_FUNC) perl_dcc_send_fill_hash); irssi_add_plains(irc_plains); + perl_eval_pv("@Irssi::Irc::Dcc::Chat::ISA = qw(Irssi::Irc::Dcc);\n" + "@Irssi::Irc::Dcc::Get::ISA = qw(Irssi::Irc::Dcc);\n" + "@Irssi::Irc::Dcc::Send::ISA = qw(Irssi::Irc::Dcc);\n", + TRUE); + INCLUDE: IrcServer.xs INCLUDE: IrcChannel.xs INCLUDE: IrcQuery.xs diff --git a/src/perl/irc/module.h b/src/perl/irc/module.h index 170dddc3..7f35b4a6 100644 --- a/src/perl/irc/module.h +++ b/src/perl/irc/module.h @@ -14,9 +14,14 @@ #include "dcc/dcc.h" #include "dcc/dcc-chat.h" #include "dcc/dcc-get.h" +#include "dcc/dcc-send.h" #include "flood/autoignore.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; @@ -25,6 +30,9 @@ typedef NICK_REC *Irssi__Irc__Nick; typedef BAN_REC *Irssi__Irc__Ban; typedef DCC_REC *Irssi__Irc__Dcc; +typedef CHAT_DCC_REC *Irssi__Irc__Dcc__Chat; +typedef GET_DCC_REC *Irssi__Irc__Dcc__Get; +typedef SEND_DCC_REC *Irssi__Irc__Dcc__Send; typedef NETSPLIT_REC *Irssi__Irc__Netsplit; typedef NETSPLIT_SERVER_REC *Irssi__Irc__Netsplitserver; typedef NETSPLIT_CHAN_REC *Irssi__Irc__Netsplitchannel; diff --git a/src/perl/irc/typemap b/src/perl/irc/typemap index bfd3954d..8608e384 100644 --- a/src/perl/irc/typemap +++ b/src/perl/irc/typemap @@ -6,7 +6,10 @@ Irssi::Irc::Query T_IrssiObj Irssi::Irc::Nick T_IrssiObj Irssi::Irc::Ban T_PlainObj -Irssi::Irc::Dcc T_PlainObj +Irssi::Irc::Dcc T_DccObj +Irssi::Irc::Dcc::Chat T_DccObj +Irssi::Irc::Dcc::Get T_DccObj +Irssi::Irc::Dcc::Send T_DccObj Irssi::Irc::Netsplit T_PlainObj Irssi::Irc::Netsplitserver T_PlainObj Irssi::Irc::Netsplitchannel T_PlainObj @@ -20,6 +23,9 @@ INPUT T_IrssiObj $var = irssi_ref_object($arg) +T_DccObj + $var = irssi_ref_object($arg) + T_PlainObj $var = irssi_ref_object($arg) @@ -28,6 +34,9 @@ OUTPUT T_IrssiObj $arg = irssi_bless((SERVER_REC *)$var); +T_DccObj + $arg = dcc_bless((DCC_REC *)$var); + T_PlainObj $arg = irssi_bless_plain(\"$type\", $var); |