Show reason if channel can not be joined because the nickname is not registered.
[xudocci.git] / src / main / java / net / pterodactylus / irc / event / DccAcceptReceived.java
1 /*
2  * XdccDownloader - DccSendReceived.java - Copyright © 2013 David Roden
3  *
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.
8  *
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.
13  *
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/>.
16  */
17
18 package net.pterodactylus.irc.event;
19
20 import net.pterodactylus.irc.Connection;
21 import net.pterodactylus.irc.Source;
22
23 /**
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
26  * RESUME} request.
27  *
28  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
29  */
30 public class DccAcceptReceived extends AbstractConnectionEvent {
31
32         /** The source of the DCC SEND. */
33         private final Source source;
34
35         /** The name of the file being offered. */
36         private final String filename;
37
38         /** The port number of the source. */
39         private final int port;
40
41         /** The position at which the download will start. */
42         private final long position;
43
44         /**
45          * Creates a new DCC ACCEPT received event.
46          *
47          * @param connection
48          *              The connetion the event occured on
49          * @param source
50          *              The source offering the file
51          * @param filename
52          *              The name of the file being offered
53          * @param port
54          *              The port number of the source
55          * @param position
56          *              The size of the file being offered ({@code -1} for unknown size)
57          */
58         public DccAcceptReceived(Connection connection, Source source, String filename, int port, long position) {
59                 super(connection);
60                 this.source = source;
61                 this.filename = filename;
62                 this.port = port;
63                 this.position = position;
64         }
65
66         //
67         // ACCESSORS
68         //
69
70         /**
71          * Returns the source offering the file.
72          *
73          * @return The source offering the file
74          */
75         public Source source() {
76                 return source;
77         }
78
79         /**
80          * Returns the name of the file being offered.
81          *
82          * @return The name of the file being offered
83          */
84         public String filename() {
85                 return filename;
86         }
87
88         /**
89          * Returns the position at which the download will start.
90          *
91          * @return The position at which the download will start
92          */
93         public long position() {
94                 return position;
95         }
96
97         /**
98          * Returns the port number of the source.
99          *
100          * @return The port number of the source
101          */
102         public int port() {
103                 return port;
104         }
105
106 }