summaryrefslogtreecommitdiff
path: root/src/perl/xs/Irssi-dcc.xs
blob: 971cc4659b53989c9add2f97466402ed3eb2ecb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
MODULE = Irssi  PACKAGE = Irssi

void
dccs()
PREINIT:
	GSList *tmp;
	HV *stash;
PPCODE:
	stash = gv_stashpv("Irssi::Dcc", 0);
	for (tmp = dcc_conns; tmp != NULL; tmp = tmp->next) {
		XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
	}

Irssi::Dcc
dcc_find_item(type, nick, arg)
	int type
	char *nick
	char *arg

Irssi::Dcc
dcc_find_by_port(nick, port)
	char *nick
	int port

void
dcc_ctcp_message(target, server, chat, notice, msg)
	char *target
	Irssi::Server server
	Irssi::Dcc chat
	int notice
	char *msg

Irssi::Dcc
item_get_dcc(item)
	void *item

#*******************************
MODULE = Irssi  PACKAGE = Irssi::Dcc  PREFIX = dcc_
#*******************************

void
dcc_destroy(dcc)
	Irssi::Dcc dcc

void
dcc_chat_send(dcc, data)
	Irssi::Dcc dcc
	char *data

void
values(dcc)
	Irssi::Dcc dcc
PREINIT:
        HV *hv, *stash;
PPCODE:
	hv = newHV();
	hv_store(hv, "type", 4, new_pv((char *) dcc_type2str(dcc->type)), 0);
	hv_store(hv, "created", 7, newSViv(dcc->created), 0);

	stash = gv_stashpv("Irssi::Server", 0);
	hv_store(hv, "server", 6, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(dcc->server))), stash), 0);
	hv_store(hv, "nick", 4, new_pv(dcc->nick), 0);

	stash = gv_stashpv("Irssi::Dcc", 0);
	hv_store(hv, "chat", 4, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(dcc->chat))), stash), 0);

	hv_store(hv, "ircnet", 6, new_pv(dcc->ircnet), 0);
	hv_store(hv, "mynick", 6, new_pv(dcc->mynick), 0);

	hv_store(hv, "arg", 3, new_pv(dcc->arg), 0);
	hv_store(hv, "file", 4, new_pv(dcc->file), 0);

	hv_store(hv, "addr", 4, new_pv(dcc->addrstr), 0);
	hv_store(hv, "port", 4, newSViv(dcc->port), 0);

	hv_store(hv, "size", 4, newSViv(dcc->size), 0);
	hv_store(hv, "transfd", 7, newSViv(dcc->transfd), 0);
	hv_store(hv, "skipped", 7, newSViv(dcc->skipped), 0);
	hv_store(hv, "starttime", 9, newSViv(dcc->starttime), 0);
	XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));