|
@@ -22,8 +22,7 @@
|
22
|
22
|
|
23
|
23
|
package com.dmdirc.ui.messages;
|
24
|
24
|
|
25
|
|
-import com.dmdirc.FrameContainer;
|
26
|
|
-import com.dmdirc.Server;
|
|
25
|
+import com.dmdirc.interfaces.Connection;
|
27
|
26
|
import com.dmdirc.interfaces.config.AggregateConfigProvider;
|
28
|
27
|
import com.dmdirc.interfaces.config.ConfigChangeListener;
|
29
|
28
|
import com.dmdirc.logger.ErrorLevel;
|
|
@@ -139,31 +138,24 @@ public class Styliser implements ConfigChangeListener {
|
139
|
138
|
/** Colours to use for URI and channel links. */
|
140
|
139
|
private Colour uriColour, channelColour;
|
141
|
140
|
|
142
|
|
- /** Server to get channel prefixes from, or null if not applicable. */
|
143
|
|
- private final Server server;
|
|
141
|
+ /** Connection to get channel prefixes from, or null if not applicable. */
|
|
142
|
+ private final Connection connection;
|
|
143
|
+
|
144
|
144
|
/** Config manager to retrieve settings from. */
|
145
|
145
|
private final AggregateConfigProvider configManager;
|
|
146
|
+
|
146
|
147
|
/** Colour manager to use to parse colours. */
|
147
|
148
|
private final ColourManager colourManager;
|
148
|
149
|
|
149
|
150
|
/**
|
150
|
151
|
* Creates a new instance of Styliser.
|
151
|
152
|
*
|
152
|
|
- * @param owner The {@link FrameContainer} that owns this styliser.
|
153
|
|
- */
|
154
|
|
- public Styliser(final FrameContainer owner) {
|
155
|
|
- this(owner.getServer(), owner.getConfigManager());
|
156
|
|
- }
|
157
|
|
-
|
158
|
|
- /**
|
159
|
|
- * Creates a new instance of Styliser.
|
160
|
|
- *
|
161
|
|
- * @param server The {@link Server} that owns this styliser or null if n/a.
|
|
153
|
+ * @param connection The {@link Connection} that this styliser is for. May be {@code null}.
|
162
|
154
|
* @param configManager the {@link AggregateConfigProvider} to get settings from.
|
163
|
155
|
* @since 0.6.3
|
164
|
156
|
*/
|
165
|
|
- public Styliser(final Server server, final AggregateConfigProvider configManager) {
|
166
|
|
- this.server = server;
|
|
157
|
+ public Styliser(final Connection connection, final AggregateConfigProvider configManager) {
|
|
158
|
+ this.connection = connection;
|
167
|
159
|
this.configManager = configManager;
|
168
|
160
|
|
169
|
161
|
// TODO: This should probably be passed in, not created here.
|
|
@@ -303,8 +295,8 @@ public class Styliser implements ConfigChangeListener {
|
303
|
295
|
*/
|
304
|
296
|
public String doLinks(final String string) {
|
305
|
297
|
String target = string;
|
306
|
|
- final String prefixes = server == null ? null
|
307
|
|
- : server.getChannelPrefixes();
|
|
298
|
+ final String prefixes = connection == null ? null
|
|
299
|
+ : connection.getChannelPrefixes();
|
308
|
300
|
|
309
|
301
|
String target2 = target;
|
310
|
302
|
target = target.replaceAll(URL_REGEXP, CODE_HYPERLINK + "$0" + CODE_HYPERLINK);
|