2 * XdccDownloader - DccSendReceived.java - Copyright © 2013 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.irc.event;
20 import net.pterodactylus.irc.Connection;
21 import net.pterodactylus.irc.Source;
24 * Notifies a listener that a DCC ACCEPT message was received. A DCC ACCEPT is a
25 * response to a {@link Connection#sendDccResume(String, String, int, long) DCC
28 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
30 public class DccAcceptReceived extends AbstractConnectionEvent {
32 /** The source of the DCC SEND. */
33 private final Source source;
35 /** The name of the file being offered. */
36 private final String filename;
38 /** The port number of the source. */
39 private final int port;
41 /** The position at which the download will start. */
42 private final long position;
45 * Creates a new DCC ACCEPT received event.
48 * The connetion the event occured on
50 * The source offering the file
52 * The name of the file being offered
54 * The port number of the source
56 * The size of the file being offered ({@code -1} for unknown size)
58 public DccAcceptReceived(Connection connection, Source source, String filename, int port, long position) {
61 this.filename = filename;
63 this.position = position;
71 * Returns the source offering the file.
73 * @return The source offering the file
75 public Source source() {
80 * Returns the name of the file being offered.
82 * @return The name of the file being offered
84 public String filename() {
89 * Returns the position at which the download will start.
91 * @return The position at which the download will start
93 public long position() {
98 * Returns the port number of the source.
100 * @return The port number of the source