1POE::Component::IRC::PlUusgeirn:C:oDnCtCr(i3b)uted PerlPDOoEc:u:mCeonmtpaotnieonnt::IRC::Plugin::DCC(3)
2
3
4
6 POE::Component::IRC::Plugin::DCC - A PoCo-IRC plugin providing support
7 for DCC transfers
8
10 # send a file
11 my $file = '/home/user/secret.pdf';
12 my $recipient = 'that_guy';
13 $irc->yield(dcc => $recipient => SEND => $file);
14
15 # receive a file
16 sub irc_dcc_request {
17 my ($user, $type, $port, $cookie, $file, $size, $addr) = @_[ARG0..$#_];
18 return if $type ne 'SEND';
19
20 my $irc = $_[SENDER]->get_heap();
21 my $nick = (split /!/, $user)[0];
22
23 print "$nick wants to send me '$file' ($size bytes) from $addr:$port\n");
24 $irc->yield(dcc_accept => $cookie);
25 }
26
28 This plugin provides the IRC commands needed to make use of DCC. It is
29 used internally by POE::Component::IRC so there's no need to add it
30 manually.
31
33 "new"
34 Takes no arguments.
35
36 Returns a plugin object suitable for feeding to POE::Component::IRC's
37 "plugin_add" method.
38
39 "dccports"
40 Sets the TCP ports that can be used for DCC sends. Takes one argument,
41 an arrayref containing the port numbers.
42
43 "nataddr"
44 Sets the public NAT address to be used for DCC sends.
45
46 "dcc_info"
47 Takes one argument, a DCC connection id (see below). Returns a hash of
48 information about the connection. The keys are: 'nick', 'type', 'port',
49 'file', 'size', 'done,', and 'peeraddr'.
50
52 The plugin responds to the following POE::Component::IRC commands.
53
54 "dcc"
55 Send a DCC SEND or CHAT request to another person. Takes at least two
56 arguments: the nickname of the person to send the request to and the
57 type of DCC request (SEND or CHAT). For SEND requests, be sure to add a
58 third argument for the filename you want to send. Optionally, you can
59 add a fourth argument for the DCC transfer blocksize, but the default
60 of 1024 should usually be fine. The fifth (and optional) argument is
61 the request timeout value in seconds (default: 300).
62
63 Incidentally, you can send other weird nonstandard kinds of DCCs too;
64 just put something besides 'SEND' or 'CHAT' (say, 'FOO') in the type
65 field, and you'll get back "irc_dcc_foo" events (with the same
66 arguments as "irc_dcc_chat") when data arrives on its DCC connection.
67
68 If you are behind a firewall or Network Address Translation, you may
69 want to consult POE::Component::IRC's "connect" for some parameters
70 that are useful with this command.
71
72 "dcc_accept"
73 Accepts an incoming DCC connection from another host. First argument:
74 the magic cookie from an "irc_dcc_request" event. In the case of a DCC
75 GET, the second argument can optionally specify a new name for the
76 destination file of the DCC transfer, instead of using the sender's
77 name for it. (See the "irc_dcc_request" section below for more
78 details.)
79
80 "dcc_resume"
81 Resumes a DCC SEND file transfer. First argument: the magic cookie from
82 an "irc_dcc_request" event. An optional second argument provides the
83 name of the file to which you want to write.
84
85 "dcc_chat"
86 Sends lines of data to the person on the other side of a DCC CHAT
87 connection. The first argument should be the wheel id of the
88 connection which you got from an "irc_dcc_start" event, followed by all
89 the data you wish to send (it'll be separated with newlines for you).
90
91 "dcc_close"
92 Terminates a DCC SEND or GET connection prematurely, and causes DCC
93 CHAT connections to close gracefully. Takes one argument: the wheel id
94 of the connection which you got from an "irc_dcc_start" (or similar)
95 event.
96
98 "irc_dcc_request"
99 Note: This event is actually emitted by POE::Filter::IRC::Compat, but
100 documented here to keep all the DCC documentation in one place. In case
101 you were wondering.
102
103 You receive this event when another IRC client sends you a DCC (e.g.
104 SEND or CHAT) request out of the blue. You can examine the request and
105 decide whether or not to accept it (with "dcc_accept") here. In the
106 case of DCC SENDs, you can also request to resume the file with
107 "dcc_resume".
108
109 Note: DCC doesn't provide a way to explicitly reject requests, so if
110 you don't intend to accept one, just ignore it or send a NOTICE or
111 PRIVMSG to the peer explaining why you're not going to accept.
112
113 • "ARG0": the peer's nick!user@host
114
115 • "ARG1": the DCC type (e.g. 'CHAT' or 'SEND')
116
117 • "ARG2": the port which the peer is listening on
118
119 • "ARG3": this connection's "magic cookie"
120
121 • "ARG4": the file name (SEND only)
122
123 • "ARG5": the file size (SEND only)
124
125 • "ARG6": the IP address which the peer is listening on
126
127 "irc_dcc_start"
128 This event notifies you that a DCC connection has been successfully
129 established.
130
131 • "ARG0": the connection's wheel id
132
133 • "ARG1": the peer's nickname
134
135 • "ARG2": the DCC type
136
137 • "ARG3": the port number
138
139 • "ARG4": the file name (SEND/GET only)
140
141 • "ARG5": the file size (SEND/GET only)
142
143 • "ARG6": the peer's IP address
144
145 "irc_dcc_chat"
146 Notifies you that one line of text has been received from the client on
147 the other end of a DCC CHAT connection.
148
149 • "ARG0": the connection's wheel id
150
151 • "ARG1": the peer's nickname
152
153 • "ARG2": the port number
154
155 • "ARG3": the text they sent
156
157 • "ARG4": the peer's IP address
158
159 "irc_dcc_get"
160 Notifies you that another block of data has been successfully
161 transferred from the client on the other end of your DCC GET
162 connection.
163
164 • "ARG0": the connection's wheel id
165
166 • "ARG1": the peer's nickname
167
168 • "ARG2": the port number
169
170 • "ARG3": the file name
171
172 • "ARG4": the file size
173
174 • "ARG5": transferred file size
175
176 • "ARG6": the peer's IP address
177
178 "irc_dcc_send"
179 Notifies you that another block of data has been successfully
180 transferred from you to the client on the other end of a DCC SEND
181 connection.
182
183 • "ARG0": the connection's wheel id
184
185 • "ARG1": the peer's nickname
186
187 • "ARG2": the port number
188
189 • "ARG3": the file name
190
191 • "ARG4": the file size
192
193 • "ARG5": transferred file size
194
195 • "ARG6": the peer's IP address
196
197 "irc_dcc_done"
198 You receive this event when a DCC connection terminates normally.
199 Abnormal terminations are reported by "irc_dcc_error".
200
201 • "ARG0": the connection's wheel id
202
203 • "ARG1": the peer's nickname
204
205 • "ARG2": the DCC type
206
207 • "ARG3": the port number
208
209 • "ARG4": the filename (SEND/GET only)
210
211 • "ARG5": file size (SEND/GET only)
212
213 • "ARG6": transferred file size (SEND/GET only)
214
215 • "ARG7": the peer's IP address
216
217 "irc_dcc_error"
218 You get this event whenever a DCC connection or connection attempt
219 terminates unexpectedly or suffers some fatal error. Some of the
220 following values might be undefined depending the stage at which the
221 connection/attempt failed.
222
223 • "ARG0": the connection's wheel id
224
225 • "ARG1": the error string
226
227 • "ARG2": the peer's nickname
228
229 • "ARG3": the DCC type
230
231 • "ARG4": the port number
232
233 • "ARG5": the file name
234
235 • "ARG6": file size in bytes
236
237 • "ARG7": transferred file size in bytes
238
239 • "ARG8": the peer's IP address
240
242 Dennis '"fimmtiu"' Taylor and Hinrik Örn Sigurðsson,
243 hinrik.sig@gmail.com
244
245
246
247perl v5.32.1 2021-01-27POE::Component::IRC::Plugin::DCC(3)