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 java.net.InetAddress;
22 import net.pterodactylus.irc.Connection;
23 import net.pterodactylus.irc.Source;
26 * Notifies a listener that a DCC SEND message was received.
28 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
30 public class DccSendReceived 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 IP address of the source. */
39 private final InetAddress inetAddress;
41 /** The port number of the source. */
42 private final int port;
45 private final long filesize;
47 private final String token;
49 public DccSendReceived(Connection connection, Source source, String filename, InetAddress inetAddress, int port, long filesize, String token) {
52 this.filename = filename;
53 this.inetAddress = inetAddress;
55 this.filesize = filesize;
64 * Returns the source offering the file.
66 * @return The source offering the file
68 public Source source() {
73 * Returns the name of the file being offered.
75 * @return The name of the file being offered
77 public String filename() {
82 * Returns the size of the file being offered. If the size is not known, {@code
85 * @return The size of the file being offered, or {@code -1} if the size is not
88 public long filesize() {
93 * Return the IP address of the source.
95 * @return The IP address of the source
97 public InetAddress inetAddress() {
102 * Returns the port number of the source.
104 * @return The port number of the source
110 public String token() {