|
@@ -23,6 +23,7 @@
|
23
|
23
|
package com.dmdirc.addons.dcc;
|
24
|
24
|
|
25
|
25
|
import com.dmdirc.DMDircMBassador;
|
|
26
|
+import com.dmdirc.DefaultInputModel;
|
26
|
27
|
import com.dmdirc.addons.dcc.events.DccChatMessageEvent;
|
27
|
28
|
import com.dmdirc.addons.dcc.events.DccChatSelfMessageEvent;
|
28
|
29
|
import com.dmdirc.addons.dcc.events.DccChatSocketClosedEvent;
|
|
@@ -30,7 +31,6 @@ import com.dmdirc.addons.dcc.events.DccChatSocketOpenedEvent;
|
30
|
31
|
import com.dmdirc.addons.dcc.io.DCCChat;
|
31
|
32
|
import com.dmdirc.events.CommandErrorEvent;
|
32
|
33
|
import com.dmdirc.interfaces.CommandController;
|
33
|
|
-import com.dmdirc.interfaces.WindowModel;
|
34
|
34
|
import com.dmdirc.interfaces.config.AggregateConfigProvider;
|
35
|
35
|
import com.dmdirc.ui.core.components.WindowComponent;
|
36
|
36
|
import com.dmdirc.ui.input.TabCompleterFactory;
|
|
@@ -38,8 +38,6 @@ import com.dmdirc.ui.messages.BackBufferFactory;
|
38
|
38
|
|
39
|
39
|
import java.util.Arrays;
|
40
|
40
|
|
41
|
|
-import javax.annotation.Nullable;
|
42
|
|
-
|
43
|
41
|
/**
|
44
|
42
|
* This class links DCC Chat objects to a window.
|
45
|
43
|
*/
|
|
@@ -57,7 +55,6 @@ public class ChatContainer extends DCCFrameContainer implements DCCChatHandler {
|
57
|
55
|
/**
|
58
|
56
|
* Creates a new instance of DCCChatWindow with a given DCCChat object.
|
59
|
57
|
*
|
60
|
|
- * @param parent The parent of this frame container, if any.
|
61
|
58
|
* @param dcc The DCCChat object this window wraps around
|
62
|
59
|
* @param configManager Config manager
|
63
|
60
|
* @param commandController The controller to use in the command parser.
|
|
@@ -78,12 +75,15 @@ public class ChatContainer extends DCCFrameContainer implements DCCChatHandler {
|
78
|
75
|
final TabCompleterFactory tabCompleterFactory,
|
79
|
76
|
final DMDircMBassador eventBus) {
|
80
|
77
|
super(title, "dcc-chat-inactive", configManager, backBufferFactory,
|
81
|
|
- new DCCCommandParser(configManager, commandController, eventBus),
|
82
|
|
- tabCompleterFactory,
|
83
|
78
|
eventBus,
|
84
|
79
|
Arrays.asList(
|
85
|
80
|
WindowComponent.TEXTAREA.getIdentifier(),
|
86
|
81
|
WindowComponent.INPUTFIELD.getIdentifier()));
|
|
82
|
+ setInputModel(new DefaultInputModel(
|
|
83
|
+ this::sendLine,
|
|
84
|
+ new DCCCommandParser(configManager, commandController, eventBus),
|
|
85
|
+ tabCompleterFactory.getTabCompleter(configManager),
|
|
86
|
+ () -> 512));
|
87
|
87
|
dccChat = dcc;
|
88
|
88
|
dcc.setHandler(this);
|
89
|
89
|
nickname = nick;
|
|
@@ -101,8 +101,7 @@ public class ChatContainer extends DCCFrameContainer implements DCCChatHandler {
|
101
|
101
|
return dccChat;
|
102
|
102
|
}
|
103
|
103
|
|
104
|
|
- @Override
|
105
|
|
- public void sendLine(final String line) {
|
|
104
|
+ private void sendLine(final String line) {
|
106
|
105
|
if (dccChat.isWriteable()) {
|
107
|
106
|
eventBus.publishAsync(new DccChatSelfMessageEvent(this, nickname, line));
|
108
|
107
|
dccChat.sendLine(line);
|