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

DCC updates

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1267 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-02-20 02:37:01 +00:00 committed by cras
parent 7a6c3f0b7c
commit 2aeb9259e0
5 changed files with 123 additions and 8 deletions

View File

@ -4,12 +4,29 @@ void
dccs() dccs()
PREINIT: PREINIT:
GSList *tmp; GSList *tmp;
HV *stash;
PPCODE: PPCODE:
stash = gv_stashpv("Irssi::Irc::Dcc", 0); for (tmp = dcc_conns; tmp != NULL; tmp = tmp->next)
for (tmp = dcc_conns; tmp != NULL; tmp = tmp->next) { XPUSHs(sv_2mortal(dcc_bless((DCC_REC *) tmp->data)));
push_bless(tmp->data, stash);
} 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 Irssi::Irc::Dcc
dcc_find_request_latest(type) dcc_find_request_latest(type)
@ -21,6 +38,23 @@ dcc_find_request(type, nick, arg)
char *nick char *nick
char *arg 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 * char *
dcc_get_download_path(fname) dcc_get_download_path(fname)
char *fname char *fname
@ -29,11 +63,31 @@ dcc_get_download_path(fname)
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Dcc PREFIX = dcc_ 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 void
dcc_destroy(dcc) dcc_destroy(dcc)
Irssi::Irc::Dcc dcc Irssi::Irc::Dcc dcc
void void
dcc_close(dcc)
Irssi::Irc::Dcc dcc
void
dcc_reject(dcc, server) dcc_reject(dcc, server)
Irssi::Irc::Dcc dcc Irssi::Irc::Dcc dcc
Irssi::Irc::Server server Irssi::Irc::Server server
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Windowitem PREFIX = item_
#*******************************
Irssi::Irc::Dcc::Chat
item_get_dcc(item)
Irssi::Windowitem item

View File

@ -26,6 +26,8 @@ static void perl_dcc_fill_hash(HV *hv, DCC_REC *dcc)
{ {
HV *stash; 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, "created", 7, newSViv(dcc->created), 0);
hv_store(hv, "server", 6, irssi_bless(dcc->server), 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, "mynick", 6, new_pv(dcc->mynick), 0);
hv_store(hv, "nick", 4, new_pv(dcc->nick), 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, "chat", 4, new_bless(dcc->chat, stash), 0);
hv_store(hv, "target", 6, new_pv(dcc->target), 0); hv_store(hv, "target", 6, new_pv(dcc->target), 0);
hv_store(hv, "arg", 3, new_pv(dcc->arg), 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); 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) static void perl_netsplit_fill_hash(HV *hv, NETSPLIT_REC *netsplit)
{ {
AV *av; AV *av;
@ -135,8 +164,22 @@ CODE:
irssi_add_object(module_get_uniq_id("SERVER", 0), irssi_add_object(module_get_uniq_id("SERVER", 0),
chat_type, "Irssi::Irc::Server", chat_type, "Irssi::Irc::Server",
(PERL_OBJECT_FUNC) perl_irc_server_fill_hash); (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); 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: IrcServer.xs
INCLUDE: IrcChannel.xs INCLUDE: IrcChannel.xs
INCLUDE: IrcQuery.xs INCLUDE: IrcQuery.xs

View File

@ -14,9 +14,14 @@
#include "dcc/dcc.h" #include "dcc/dcc.h"
#include "dcc/dcc-chat.h" #include "dcc/dcc-chat.h"
#include "dcc/dcc-get.h" #include "dcc/dcc-get.h"
#include "dcc/dcc-send.h"
#include "flood/autoignore.h" #include "flood/autoignore.h"
#include "notifylist/notifylist.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_REC *Irssi__Irc__Server;
typedef IRC_SERVER_CONNECT_REC *Irssi__Irc__Connect; typedef IRC_SERVER_CONNECT_REC *Irssi__Irc__Connect;
typedef IRC_CHANNEL_REC *Irssi__Irc__Channel; typedef IRC_CHANNEL_REC *Irssi__Irc__Channel;
@ -25,6 +30,9 @@ typedef NICK_REC *Irssi__Irc__Nick;
typedef BAN_REC *Irssi__Irc__Ban; typedef BAN_REC *Irssi__Irc__Ban;
typedef DCC_REC *Irssi__Irc__Dcc; 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_REC *Irssi__Irc__Netsplit;
typedef NETSPLIT_SERVER_REC *Irssi__Irc__Netsplitserver; typedef NETSPLIT_SERVER_REC *Irssi__Irc__Netsplitserver;
typedef NETSPLIT_CHAN_REC *Irssi__Irc__Netsplitchannel; typedef NETSPLIT_CHAN_REC *Irssi__Irc__Netsplitchannel;

View File

@ -6,7 +6,10 @@ Irssi::Irc::Query T_IrssiObj
Irssi::Irc::Nick T_IrssiObj Irssi::Irc::Nick T_IrssiObj
Irssi::Irc::Ban T_PlainObj 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::Netsplit T_PlainObj
Irssi::Irc::Netsplitserver T_PlainObj Irssi::Irc::Netsplitserver T_PlainObj
Irssi::Irc::Netsplitchannel T_PlainObj Irssi::Irc::Netsplitchannel T_PlainObj
@ -20,6 +23,9 @@ INPUT
T_IrssiObj T_IrssiObj
$var = irssi_ref_object($arg) $var = irssi_ref_object($arg)
T_DccObj
$var = irssi_ref_object($arg)
T_PlainObj T_PlainObj
$var = irssi_ref_object($arg) $var = irssi_ref_object($arg)
@ -28,6 +34,9 @@ OUTPUT
T_IrssiObj T_IrssiObj
$arg = irssi_bless((SERVER_REC *)$var); $arg = irssi_bless((SERVER_REC *)$var);
T_DccObj
$arg = dcc_bless((DCC_REC *)$var);
T_PlainObj T_PlainObj
$arg = irssi_bless_plain(\"$type\", $var); $arg = irssi_bless_plain(\"$type\", $var);

View File

@ -288,6 +288,7 @@ void perl_nick_fill_hash(HV *hv, NICK_REC *nick)
type = "NICK"; type = "NICK";
chat_type = (char *) chat_protocol_find_id(nick->chat_type)->name; chat_type = (char *) chat_protocol_find_id(nick->chat_type)->name;
hv_store(hv, "type", 4, new_pv(type), 0);
hv_store(hv, "last_check", 10, newSViv(nick->last_check), 0); hv_store(hv, "last_check", 10, newSViv(nick->last_check), 0);
hv_store(hv, "nick", 4, new_pv(nick->nick), 0); hv_store(hv, "nick", 4, new_pv(nick->nick), 0);