Browse Source

Convert DCC Plugin to use events.

Change-Id: I136ba57bfa1a421d845351bb6c75b4b35dfb45df
Reviewed-on: http://gerrit.dmdirc.com/3494
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
changes/94/3494/4
Greg Holmes 10 years ago
parent
commit
16dc8c84a7

+ 22
- 20
src/com/dmdirc/addons/dcc/ChatContainer.java View File

@@ -23,9 +23,13 @@
23 23
 package com.dmdirc.addons.dcc;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.actions.ActionManager;
27
-import com.dmdirc.addons.dcc.actions.DCCActions;
26
+import com.dmdirc.addons.dcc.events.DccChatMessageEvent;
27
+import com.dmdirc.addons.dcc.events.DccChatSelfmessageEvent;
28
+import com.dmdirc.addons.dcc.events.DccChatSocketclosedEvent;
29
+import com.dmdirc.addons.dcc.events.DccChatSocketopenedEvent;
28 30
 import com.dmdirc.addons.dcc.io.DCCChat;
31
+import com.dmdirc.events.DisplayableEvent;
32
+import com.dmdirc.events.EventUtils;
29 33
 import com.dmdirc.interfaces.CommandController;
30 34
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
31 35
 import com.dmdirc.messages.MessageSinkManager;
@@ -50,6 +54,8 @@ public class ChatContainer extends DCCFrameContainer implements DCCChatHandler {
50 54
     private final String nickname;
51 55
     /** Other Nickname. */
52 56
     private final String otherNickname;
57
+    /** Event bus to post events on. */
58
+    private final EventBus eventBus;
53 59
 
54 60
     /**
55 61
      * Creates a new instance of DCCChatWindow with a given DCCChat object.
@@ -91,6 +97,7 @@ public class ChatContainer extends DCCFrameContainer implements DCCChatHandler {
91 97
         dcc.setHandler(this);
92 98
         nickname = nick;
93 99
         otherNickname = targetNick;
100
+        this.eventBus = eventBus;
94 101
     }
95 102
 
96 103
     /**
@@ -105,31 +112,27 @@ public class ChatContainer extends DCCFrameContainer implements DCCChatHandler {
105 112
     @Override
106 113
     public void sendLine(final String line) {
107 114
         if (dccChat.isWriteable()) {
108
-            final StringBuffer buff = new StringBuffer("DCCChatSelfMessage");
109
-            ActionManager.getActionManager().triggerEvent(
110
-                    DCCActions.DCC_CHAT_SELFMESSAGE, buff, this, line);
111
-            addLine(buff, nickname, line);
115
+            final DisplayableEvent event = new DccChatSelfmessageEvent(this, line);
116
+            final String format = EventUtils.postDisplayable(eventBus, event, "DCCChatSelfMessage");
117
+            addLine(format, nickname, line);
112 118
             dccChat.sendLine(line);
113 119
         } else {
114
-            final StringBuffer buff = new StringBuffer("DCCChatError");
115
-            addLine(buff, "Socket is closed.", line);
120
+            addLine("DCCChatError", "Socket is closed.", line);
116 121
         }
117 122
     }
118 123
 
119 124
     @Override
120 125
     public void handleChatMessage(final DCCChat dcc, final String message) {
121
-        final StringBuffer buff = new StringBuffer("DCCChatMessage");
122
-        ActionManager.getActionManager().triggerEvent(
123
-                DCCActions.DCC_CHAT_MESSAGE, buff, this, otherNickname, message);
124
-        addLine(buff, otherNickname, message);
126
+        final DisplayableEvent event = new DccChatMessageEvent(this, otherNickname, message);
127
+        final String format = EventUtils.postDisplayable(eventBus, event, "DCCChatMessage");
128
+        addLine(format, otherNickname, message);
125 129
     }
126 130
 
127 131
     @Override
128 132
     public void socketClosed(final DCCChat dcc) {
129
-        final StringBuffer buff = new StringBuffer("DCCChatInfo");
130
-        ActionManager.getActionManager().triggerEvent(
131
-                DCCActions.DCC_CHAT_SOCKETCLOSED, buff, this);
132
-        addLine(buff, "Socket closed");
133
+        final DisplayableEvent event = new DccChatSocketclosedEvent(this);
134
+        final String format = EventUtils.postDisplayable(eventBus, event, "DCCChatInfo");
135
+        addLine(format, "Socket closed");
133 136
         if (!isWindowClosing()) {
134 137
             setIcon("dcc-chat-inactive");
135 138
         }
@@ -137,10 +140,9 @@ public class ChatContainer extends DCCFrameContainer implements DCCChatHandler {
137 140
 
138 141
     @Override
139 142
     public void socketOpened(final DCCChat dcc) {
140
-        final StringBuffer buff = new StringBuffer("DCCChatInfo");
141
-        ActionManager.getActionManager().triggerEvent(
142
-                DCCActions.DCC_CHAT_SOCKETOPENED, buff, this);
143
-        addLine(buff, "Socket opened");
143
+        final DisplayableEvent event = new DccChatSocketopenedEvent(this);
144
+        final String format = EventUtils.postDisplayable(eventBus, event, "DCCChatInfo");
145
+        addLine(format, "Socket opened");
144 146
         setIcon("dcc-chat-active");
145 147
     }
146 148
 

+ 7
- 11
src/com/dmdirc/addons/dcc/DCCCommand.java View File

@@ -23,8 +23,8 @@
23 23
 package com.dmdirc.addons.dcc;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.actions.ActionManager;
27
-import com.dmdirc.addons.dcc.actions.DCCActions;
26
+import com.dmdirc.addons.dcc.events.DccChatRequestSentEvent;
27
+import com.dmdirc.addons.dcc.events.DccSendRequestEvent;
28 28
 import com.dmdirc.addons.dcc.io.DCC;
29 29
 import com.dmdirc.addons.dcc.io.DCCChat;
30 30
 import com.dmdirc.addons.dcc.io.DCCTransfer;
@@ -190,12 +190,9 @@ public class DCCCommand extends Command implements IntelligentCommand {
190 190
             windowManager.addWindow(myPlugin.getContainer(), window);
191 191
             parser.sendCTCP(target, "DCC", "CHAT chat " + DCC.ipToLong(
192 192
                     myPlugin.getListenIP(parser)) + " " + chat.getPort());
193
-            ActionManager.getActionManager().triggerEvent(
194
-                    DCCActions.DCC_CHAT_REQUEST_SENT, null, connection, target);
195
-            sendLine(origin, isSilent, "DCCChatStarting", target,
196
-                    chat.getHost(), chat.getPort());
197
-            window.addLine("DCCChatStarting", target, chat.getHost(),
198
-                    chat.getPort());
193
+            eventBus.post(new DccChatRequestSentEvent(connection, target));
194
+            sendLine(origin, isSilent, "DCCChatStarting", target, chat.getHost(), chat.getPort());
195
+            window.addLine("DCCChatStarting", target, chat.getHost(), chat.getPort());
199 196
         } else {
200 197
             sendLine(origin, isSilent, "DCCChatError",
201 198
                     "Unable to start chat with " + target
@@ -249,9 +246,8 @@ public class DCCCommand extends Command implements IntelligentCommand {
249 246
                         myPlugin.getDomain(), "send.forceturbo"));
250 247
                 send.setType(DCCTransfer.TransferType.SEND);
251 248
 
252
-                ActionManager.getActionManager().triggerEvent(
253
-                        DCCActions.DCC_SEND_REQUEST_SENT,
254
-                        null, connection, target, selectedFile);
249
+                eventBus.post(new DccSendRequestEvent(connection, target, selectedFile.
250
+                        getAbsolutePath()));
255 251
 
256 252
                 sendLine(origin, isSilent, FORMAT_OUTPUT,
257 253
                         "Starting DCC Send with: " + target);

+ 6
- 10
src/com/dmdirc/addons/dcc/DCCManager.java View File

@@ -26,7 +26,8 @@ import com.dmdirc.ClientModule.GlobalConfig;
26 26
 import com.dmdirc.FrameContainer;
27 27
 import com.dmdirc.actions.ActionManager;
28 28
 import com.dmdirc.actions.CoreActionType;
29
-import com.dmdirc.addons.dcc.actions.DCCActions;
29
+import com.dmdirc.addons.dcc.events.DccChatRequestEvent;
30
+import com.dmdirc.addons.dcc.events.DccSendRequestEvent;
30 31
 import com.dmdirc.addons.dcc.io.DCC;
31 32
 import com.dmdirc.addons.dcc.io.DCCChat;
32 33
 import com.dmdirc.addons.dcc.io.DCCTransfer;
@@ -454,9 +455,7 @@ public class DCCManager implements ActionListener {
454 455
                     chat.getPort());
455 456
             chat.connect();
456 457
         } else {
457
-            ActionManager.getActionManager().triggerEvent(
458
-                    DCCActions.DCC_CHAT_REQUEST, null, arguments[0],
459
-                    nickname);
458
+            eventBus.post(new DccChatRequestEvent((Connection) arguments[0], nickname));
460 459
             askQuestion("User " + nickname + " on "
461 460
                     + ((Connection) arguments[0]).getAddress()
462 461
                     + " would like to start a DCC Chat with you.\n\n"
@@ -547,9 +546,8 @@ public class DCCManager implements ActionListener {
547 546
             if (!token.isEmpty() && !port.equals("0")) {
548 547
                 // This is a reverse DCC Send that we no longer care about.
549 548
             } else {
550
-                ActionManager.getActionManager().triggerEvent(
551
-                        DCCActions.DCC_SEND_REQUEST, null,
552
-                        arguments[0], nickname, filename);
549
+                eventBus.post(
550
+                        new DccSendRequestEvent((Connection) arguments[0], nickname, filename));
553 551
                 askQuestion("User " + nickname + " on "
554 552
                         + ((Connection) arguments[0]).getAddress()
555 553
                         + " would like to send you a file over DCC.\n\nFile: "
@@ -720,9 +718,7 @@ public class DCCManager implements ActionListener {
720 718
             }
721 719
         }
722 720
 
723
-        ActionManager.getActionManager().registerTypes(DCCActions.values());
724
-        ActionManager.getActionManager().registerListener(this,
725
-                CoreActionType.SERVER_CTCP);
721
+        ActionManager.getActionManager().registerListener(this, CoreActionType.SERVER_CTCP);
726 722
     }
727 723
 
728 724
     /**

+ 9
- 8
src/com/dmdirc/addons/dcc/TransferContainer.java View File

@@ -24,8 +24,9 @@ package com.dmdirc.addons.dcc;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26 26
 import com.dmdirc.ServerState;
27
-import com.dmdirc.actions.ActionManager;
28
-import com.dmdirc.addons.dcc.actions.DCCActions;
27
+import com.dmdirc.addons.dcc.events.DccSendDatatransferedEvent;
28
+import com.dmdirc.addons.dcc.events.DccSendSocketclosedEvent;
29
+import com.dmdirc.addons.dcc.events.DccSendSocketopenedEvent;
29 30
 import com.dmdirc.addons.dcc.io.DCC;
30 31
 import com.dmdirc.addons.dcc.io.DCCTransfer;
31 32
 import com.dmdirc.interfaces.Connection;
@@ -72,6 +73,8 @@ public class TransferContainer extends FrameContainer implements
72 73
     /** Show open button. */
73 74
     private final boolean showOpen = Desktop.isDesktopSupported()
74 75
             && Desktop.getDesktop().isSupported(Desktop.Action.OPEN);
76
+    /** Event bus to post events on. */
77
+    private final EventBus eventBus;
75 78
 
76 79
     /**
77 80
      * Creates a new instance of DCCTransferWindow with a given DCCTransfer object.
@@ -107,6 +110,7 @@ public class TransferContainer extends FrameContainer implements
107 110
         dcc.addHandler(this);
108 111
 
109 112
         otherNickname = targetNick;
113
+        this.eventBus = eventBus;
110 114
     }
111 115
 
112 116
     @Override
@@ -168,8 +172,7 @@ public class TransferContainer extends FrameContainer implements
168 172
             setTitle(title.toString());
169 173
         }
170 174
 
171
-        ActionManager.getActionManager().triggerEvent(
172
-                DCCActions.DCC_SEND_DATATRANSFERED, null, this, bytes);
175
+        eventBus.post(new DccSendDatatransferedEvent(this, bytes));
173 176
     }
174 177
 
175 178
     /**
@@ -262,8 +265,7 @@ public class TransferContainer extends FrameContainer implements
262 265
      */
263 266
     @Override
264 267
     public void socketClosed(final DCCTransfer dcc) {
265
-        ActionManager.getActionManager().triggerEvent(
266
-                DCCActions.DCC_SEND_SOCKETCLOSED, null, this);
268
+        eventBus.post(new DccSendSocketclosedEvent(this));
267 269
         if (!windowClosing) {
268 270
             synchronized (this) {
269 271
                 if (transferCount == dcc.getFileSize() - dcc.getFileStart()) {
@@ -284,8 +286,7 @@ public class TransferContainer extends FrameContainer implements
284 286
      */
285 287
     @Override
286 288
     public void socketOpened(final DCCTransfer dcc) {
287
-        ActionManager.getActionManager().triggerEvent(
288
-                DCCActions.DCC_SEND_SOCKETOPENED, null, this);
289
+        eventBus.post(new DccSendSocketopenedEvent(this));
289 290
         timeStarted = System.currentTimeMillis();
290 291
         setIcon(dcc.getType() == DCCTransfer.TransferType.SEND
291 292
                 ? "dcc-send-active" : "dcc-receive-active");

+ 0
- 92
src/com/dmdirc/addons/dcc/actions/DCCActions.java View File

@@ -1,92 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2014 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.addons.dcc.actions;
24
-
25
-import com.dmdirc.interfaces.actions.ActionMetaType;
26
-import com.dmdirc.interfaces.actions.ActionType;
27
-
28
-/**
29
- * DCC actions.
30
- */
31
-public enum DCCActions implements ActionType {
32
-
33
-    /** DCC Chat Request. */
34
-    DCC_CHAT_REQUEST(DCCEvents.DCC_CHAT_REQUEST,
35
-            "DCC chat requested"),
36
-    /** DCC Chat Request Sent. */
37
-    DCC_CHAT_REQUEST_SENT(DCCEvents.DCC_CHAT_REQUEST_SENT,
38
-            "DCC chat request sent"),
39
-    /** DCC Message from another person. */
40
-    DCC_CHAT_MESSAGE(DCCEvents.DCC_CHAT_MESSAGE,
41
-            "DCC chat message recieved"),
42
-    /** DCC Message to another person. */
43
-    DCC_CHAT_SELFMESSAGE(DCCEvents.DCC_CHAT_SELFMESSAGE,
44
-            "DCC chat message sent"),
45
-    /** DCC Chat Socket Closed. */
46
-    DCC_CHAT_SOCKETCLOSED(DCCEvents.DCC_CHAT_SOCKETCLOSED,
47
-            "DCC chat socket closed"),
48
-    /** DCC Chat Socket Opened. */
49
-    DCC_CHAT_SOCKETOPENED(DCCEvents.DCC_CHAT_SOCKETOPENED,
50
-            "DCC chat socket opened"),
51
-    /** DCC Send Socket Closed. */
52
-    DCC_SEND_SOCKETCLOSED(DCCEvents.DCC_SEND_SOCKETCLOSED,
53
-            "DCC send socket closed"),
54
-    /** DCC Send Socket Opened. */
55
-    DCC_SEND_SOCKETOPENED(DCCEvents.DCC_SEND_SOCKETOPENED,
56
-            "DCC send socket opened"),
57
-    /** DCC Send Data Transfered. */
58
-    DCC_SEND_DATATRANSFERED(DCCEvents.DCC_SEND_DATATRANSFERED,
59
-            "DCC send data transferred"),
60
-    /** DCC Send Request. */
61
-    DCC_SEND_REQUEST(DCCEvents.DCC_SEND_REQUEST,
62
-            "DCC send requested"),
63
-    /** DCC Send Request Sent. */
64
-    DCC_SEND_REQUEST_SENT(DCCEvents.DCC_SEND_REQUEST_SENT,
65
-            "DCC send request sent");
66
-    /** The type of this action. */
67
-    private final ActionMetaType type;
68
-    /** The name of this action. */
69
-    private final String name;
70
-
71
-    /**
72
-     * Constructs a new core action.
73
-     *
74
-     * @param type The type of this action
75
-     * @param name The name of this action
76
-     */
77
-    DCCActions(final ActionMetaType type, final String name) {
78
-        this.type = type;
79
-        this.name = name;
80
-    }
81
-
82
-    @Override
83
-    public ActionMetaType getType() {
84
-        return type;
85
-    }
86
-
87
-    @Override
88
-    public String getName() {
89
-        return name;
90
-    }
91
-
92
-}

+ 0
- 99
src/com/dmdirc/addons/dcc/actions/DCCEvents.java View File

@@ -1,99 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2014 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.addons.dcc.actions;
24
-
25
-import com.dmdirc.addons.dcc.ChatContainer;
26
-import com.dmdirc.addons.dcc.TransferContainer;
27
-import com.dmdirc.interfaces.Connection;
28
-import com.dmdirc.interfaces.actions.ActionMetaType;
29
-
30
-import java.io.File;
31
-
32
-/**
33
- * Defines DCC-related events.
34
- */
35
-public enum DCCEvents implements ActionMetaType {
36
-
37
-    /** DCC Chat Request. */
38
-    DCC_CHAT_REQUEST(new String[]{"connection", "client"}, Connection.class, String.class),
39
-    /** DCC Chat Request Sent. */
40
-    DCC_CHAT_REQUEST_SENT(new String[]{"connection", "client"}, Connection.class, String.class),
41
-    /** DCC Message from another person. */
42
-    DCC_CHAT_MESSAGE(new String[]{"DCCChatWindow", "Nickname", "Message"}, ChatContainer.class,
43
-            String.class, String.class),
44
-    /** DCC Message to another person. */
45
-    DCC_CHAT_SELFMESSAGE(new String[]{"DCCChatWindow", "Message"}, ChatContainer.class, String.class),
46
-    /** DCC Chat Socket Closed. */
47
-    DCC_CHAT_SOCKETCLOSED(new String[]{"DCCChatWindow"}, ChatContainer.class),
48
-    /** DCC Chat Socket Opened. */
49
-    DCC_CHAT_SOCKETOPENED(new String[]{"DCCChatWindow"}, ChatContainer.class),
50
-    /** DCC Send Socket Closed. */
51
-    DCC_SEND_SOCKETCLOSED(new String[]{"DCCSendWindow"}, TransferContainer.class),
52
-    /** DCC Send Socket Opened. */
53
-    DCC_SEND_SOCKETOPENED(new String[]{"DCCSendWindow"}, TransferContainer.class),
54
-    /** DCC Send Data Transfered */
55
-    DCC_SEND_DATATRANSFERED(new String[]{"DCCSendWindow", "Bytes Transfered"},
56
-            TransferContainer.class, int.class),
57
-    /** DCC Send Request. */
58
-    DCC_SEND_REQUEST(new String[]{"connection", "client", "file"}, Connection.class, String.class,
59
-            String.class),
60
-    /** DCC Send Request Sent. */
61
-    DCC_SEND_REQUEST_SENT(new String[]{"connection", "client", "file"}, Connection.class,
62
-            String.class, File.class);
63
-    /** The names of the arguments for this meta type. */
64
-    private String[] argNames;
65
-    /** The classes of the arguments for this meta type. */
66
-    private Class[] argTypes;
67
-
68
-    /**
69
-     * Creates a new instance of this meta-type.
70
-     *
71
-     * @param argNames The names of the meta-type's arguments
72
-     * @param argTypes The types of the meta-type's arguments
73
-     */
74
-    DCCEvents(final String[] argNames, final Class... argTypes) {
75
-        this.argNames = argNames;
76
-        this.argTypes = argTypes;
77
-    }
78
-
79
-    @Override
80
-    public int getArity() {
81
-        return argNames.length;
82
-    }
83
-
84
-    @Override
85
-    public Class[] getArgTypes() {
86
-        return argTypes;
87
-    }
88
-
89
-    @Override
90
-    public String[] getArgNames() {
91
-        return argNames;
92
-    }
93
-
94
-    @Override
95
-    public String getGroup() {
96
-        return "DCC Events";
97
-    }
98
-
99
-}

+ 55
- 0
src/com/dmdirc/addons/dcc/events/DccChatMessageEvent.java View File

@@ -0,0 +1,55 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.dcc.events;
24
+
25
+import com.dmdirc.addons.dcc.ChatContainer;
26
+
27
+/**
28
+ * Fired when a DCC chat message is received.
29
+ */
30
+public class DccChatMessageEvent extends DccDisplayableEvent {
31
+
32
+    private final ChatContainer chatWindow;
33
+    private final String nickname;
34
+    private final String message;
35
+
36
+    public DccChatMessageEvent(final ChatContainer chatWindow, final String nickname,
37
+            final String message) {
38
+        this.chatWindow = chatWindow;
39
+        this.nickname = nickname;
40
+        this.message = message;
41
+    }
42
+
43
+    public ChatContainer getChatWindow() {
44
+        return chatWindow;
45
+    }
46
+
47
+    public String getNickname() {
48
+        return nickname;
49
+    }
50
+
51
+    public String getMessage() {
52
+        return message;
53
+    }
54
+
55
+}

+ 48
- 0
src/com/dmdirc/addons/dcc/events/DccChatRequestEvent.java View File

@@ -0,0 +1,48 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.dcc.events;
24
+
25
+import com.dmdirc.interfaces.Connection;
26
+
27
+/**
28
+ * Fired on a DCC chat request.
29
+ */
30
+public class DccChatRequestEvent extends DccEvent {
31
+
32
+    private final Connection connection;
33
+    private final String client;
34
+
35
+    public DccChatRequestEvent(final Connection connection, final String client) {
36
+        this.connection = connection;
37
+        this.client = client;
38
+    }
39
+
40
+    public Connection getConnection() {
41
+        return connection;
42
+    }
43
+
44
+    public String getClient() {
45
+        return client;
46
+    }
47
+
48
+}

+ 48
- 0
src/com/dmdirc/addons/dcc/events/DccChatRequestSentEvent.java View File

@@ -0,0 +1,48 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.dcc.events;
24
+
25
+import com.dmdirc.interfaces.Connection;
26
+
27
+/**
28
+ * Fired when a DCC chat request is sent.
29
+ */
30
+public class DccChatRequestSentEvent extends DccEvent {
31
+
32
+    private final Connection connection;
33
+    private final String client;
34
+
35
+    public DccChatRequestSentEvent(final Connection connection, final String client) {
36
+        this.connection = connection;
37
+        this.client = client;
38
+    }
39
+
40
+    public Connection getConnection() {
41
+        return connection;
42
+    }
43
+
44
+    public String getClient() {
45
+        return client;
46
+    }
47
+
48
+}

+ 48
- 0
src/com/dmdirc/addons/dcc/events/DccChatSelfmessageEvent.java View File

@@ -0,0 +1,48 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.dcc.events;
24
+
25
+import com.dmdirc.addons.dcc.ChatContainer;
26
+
27
+/**
28
+ * Fired on a DCC chat self message.
29
+ */
30
+public class DccChatSelfmessageEvent extends DccDisplayableEvent {
31
+
32
+    private final ChatContainer chatWindow;
33
+    private final String message;
34
+
35
+    public DccChatSelfmessageEvent(final ChatContainer chatWindow, final String message) {
36
+        this.chatWindow = chatWindow;
37
+        this.message = message;
38
+    }
39
+
40
+    public ChatContainer getChatWindow() {
41
+        return chatWindow;
42
+    }
43
+
44
+    public String getMessage() {
45
+        return message;
46
+    }
47
+
48
+}

+ 42
- 0
src/com/dmdirc/addons/dcc/events/DccChatSocketclosedEvent.java View File

@@ -0,0 +1,42 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.dcc.events;
24
+
25
+import com.dmdirc.addons.dcc.ChatContainer;
26
+
27
+/**
28
+ * Fired when a chat socket is closed.
29
+ */
30
+public class DccChatSocketclosedEvent extends DccDisplayableEvent {
31
+
32
+    private final ChatContainer chatWindow;
33
+
34
+    public DccChatSocketclosedEvent(final ChatContainer chatWindow) {
35
+        this.chatWindow = chatWindow;
36
+    }
37
+
38
+    public ChatContainer getChatWindow() {
39
+        return chatWindow;
40
+    }
41
+
42
+}

+ 42
- 0
src/com/dmdirc/addons/dcc/events/DccChatSocketopenedEvent.java View File

@@ -0,0 +1,42 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.dcc.events;
24
+
25
+import com.dmdirc.addons.dcc.ChatContainer;
26
+
27
+/**
28
+ * Fired when a chat socket is opened.
29
+ */
30
+public class DccChatSocketopenedEvent extends DccDisplayableEvent {
31
+
32
+    private final ChatContainer chatWindow;
33
+
34
+    public DccChatSocketopenedEvent(final ChatContainer chatWindow) {
35
+        this.chatWindow = chatWindow;
36
+    }
37
+
38
+    public ChatContainer getChatWindow() {
39
+        return chatWindow;
40
+    }
41
+
42
+}

+ 46
- 0
src/com/dmdirc/addons/dcc/events/DccDisplayableEvent.java View File

@@ -0,0 +1,46 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.dcc.events;
24
+
25
+import com.dmdirc.events.DisplayableEvent;
26
+
27
+import java.util.concurrent.atomic.AtomicReference;
28
+
29
+/**
30
+ * Base class for displayable DCC events.
31
+ */
32
+public abstract class DccDisplayableEvent extends DccEvent implements DisplayableEvent {
33
+
34
+    /** The display format to use for this event. */
35
+    private final AtomicReference<String> displayFormatRef = new AtomicReference<>("");
36
+
37
+    @Override
38
+    public String getDisplayFormat() {
39
+        return displayFormatRef.get();
40
+    }
41
+
42
+    @Override
43
+    public void setDisplayFormat(final String format) {
44
+        this.displayFormatRef.set(format);
45
+    }
46
+}

+ 32
- 0
src/com/dmdirc/addons/dcc/events/DccEvent.java View File

@@ -0,0 +1,32 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.dcc.events;
24
+
25
+import com.dmdirc.events.DMDircEvent;
26
+
27
+/**
28
+ * Base class for DCC events.
29
+ */
30
+public abstract class DccEvent extends DMDircEvent {
31
+
32
+}

+ 49
- 0
src/com/dmdirc/addons/dcc/events/DccSendDatatransferedEvent.java View File

@@ -0,0 +1,49 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.dcc.events;
24
+
25
+import com.dmdirc.addons.dcc.TransferContainer;
26
+
27
+/**
28
+ * Fired when data is transferred on a DCC transfer.
29
+ */
30
+public class DccSendDatatransferedEvent extends DccEvent {
31
+
32
+    private final TransferContainer transferWindow;
33
+    private final int bytesTransferred;
34
+
35
+    public DccSendDatatransferedEvent(final TransferContainer transferWindow,
36
+            final int bytesTransferred) {
37
+        this.transferWindow = transferWindow;
38
+        this.bytesTransferred = bytesTransferred;
39
+    }
40
+
41
+    public TransferContainer getTransferWindow() {
42
+        return transferWindow;
43
+    }
44
+
45
+    public int getBytesTransferred() {
46
+        return bytesTransferred;
47
+    }
48
+
49
+}

+ 55
- 0
src/com/dmdirc/addons/dcc/events/DccSendRequestEvent.java View File

@@ -0,0 +1,55 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.dcc.events;
24
+
25
+import com.dmdirc.interfaces.Connection;
26
+
27
+
28
+/**
29
+ * Fired when a DCC send request is made.
30
+ */
31
+public class DccSendRequestEvent extends DccEvent {
32
+
33
+    private final Connection connection;
34
+    private final String client;
35
+    private final String file;
36
+
37
+    public DccSendRequestEvent(final Connection connection, final String client, final String file) {
38
+        this.connection = connection;
39
+        this.client = client;
40
+        this.file = file;
41
+    }
42
+
43
+    public Connection getConnection() {
44
+        return connection;
45
+    }
46
+
47
+    public String getClient() {
48
+        return client;
49
+    }
50
+
51
+    public String getFile() {
52
+        return file;
53
+    }
54
+
55
+}

+ 56
- 0
src/com/dmdirc/addons/dcc/events/DccSendRequestSentEvent.java View File

@@ -0,0 +1,56 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.dcc.events;
24
+
25
+import com.dmdirc.interfaces.Connection;
26
+
27
+import java.io.File;
28
+
29
+/**
30
+ * Fired when a DCC Send request is sent.
31
+ */
32
+public class DccSendRequestSentEvent extends DccEvent {
33
+
34
+    private final Connection connection;
35
+    private final String client;
36
+    private final File file;
37
+
38
+    public DccSendRequestSentEvent(final Connection connection, final String client, final File file) {
39
+        this.connection = connection;
40
+        this.client = client;
41
+        this.file = file;
42
+    }
43
+
44
+    public Connection getConnection() {
45
+        return connection;
46
+    }
47
+
48
+    public String getClient() {
49
+        return client;
50
+    }
51
+
52
+    public File getFile() {
53
+        return file;
54
+    }
55
+
56
+}

+ 42
- 0
src/com/dmdirc/addons/dcc/events/DccSendSocketclosedEvent.java View File

@@ -0,0 +1,42 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.dcc.events;
24
+
25
+import com.dmdirc.addons.dcc.TransferContainer;
26
+
27
+/**
28
+ * Fires a when a DCC send socket is closed.
29
+ */
30
+public class DccSendSocketclosedEvent extends DccEvent {
31
+
32
+    private final TransferContainer transferWindow;
33
+
34
+    public DccSendSocketclosedEvent(final TransferContainer transferWindow) {
35
+        this.transferWindow = transferWindow;
36
+    }
37
+
38
+    public TransferContainer getTransferWindow() {
39
+        return transferWindow;
40
+    }
41
+
42
+}

+ 42
- 0
src/com/dmdirc/addons/dcc/events/DccSendSocketopenedEvent.java View File

@@ -0,0 +1,42 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.dcc.events;
24
+
25
+import com.dmdirc.addons.dcc.TransferContainer;
26
+
27
+/**
28
+ * Fired when a DCC send socket is opened.
29
+ */
30
+public class DccSendSocketopenedEvent extends DccEvent {
31
+
32
+    private final TransferContainer transferWindow;
33
+
34
+    public DccSendSocketopenedEvent(final TransferContainer transferWindow) {
35
+        this.transferWindow = transferWindow;
36
+    }
37
+
38
+    public TransferContainer getTransferWindow() {
39
+        return transferWindow;
40
+    }
41
+
42
+}

Loading…
Cancel
Save