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;
48 * Creates a new DCC SEND received event.
51 * The connetion the event occured on
53 * The source offering the file
55 * The name of the file being offered
57 * The IP address of the source
59 * The port number of the source
61 * The size of the file being offered ({@code -1} for unknown size)
63 public DccSendReceived(Connection connection, Source source, String filename, InetAddress inetAddress, int port, long filesize) {
66 this.filename = filename;
67 this.inetAddress = inetAddress;
69 this.filesize = filesize;
77 * Returns the source offering the file.
79 * @return The source offering the file
81 public Source source() {
86 * Returns the name of the file being offered.
88 * @return The name of the file being offered
90 public String filename() {
95 * Returns the size of the file being offered. If the size is not known, {@code
98 * @return The size of the file being offered, or {@code -1} if the size is not
101 public long filesize() {
106 * Return the IP address of the source.
108 * @return The IP address of the source
110 public InetAddress inetAddress() {
115 * Returns the port number of the source.
117 * @return The port number of the source