Browse Source

Fixes issue 3443: logging plugin should cache variables

Fixes issue 3444: window status plugin needs to cache values
issue 3441: twitter plugin needs to cache variables, especially debugEnabled

Change-Id: I116863f2a4e220f330aefeff9f49ed45f698c4d3
Reviewed-on: http://gerrit.dmdirc.com/363
Tested-by: Gregory Holmes <greboid@dmdirc.com>
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.6.3
Gregory Holmes 14 years ago
parent
commit
a0ae765d22

+ 67
- 29
src/com/dmdirc/addons/logging/LoggingPlugin.java View File

36
 import com.dmdirc.config.prefs.PreferencesSetting;
36
 import com.dmdirc.config.prefs.PreferencesSetting;
37
 import com.dmdirc.config.prefs.PreferencesType;
37
 import com.dmdirc.config.prefs.PreferencesType;
38
 import com.dmdirc.interfaces.ActionListener;
38
 import com.dmdirc.interfaces.ActionListener;
39
+import com.dmdirc.interfaces.ConfigChangeListener;
39
 import com.dmdirc.logger.ErrorLevel;
40
 import com.dmdirc.logger.ErrorLevel;
40
 import com.dmdirc.logger.Logger;
41
 import com.dmdirc.logger.Logger;
41
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
42
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
71
  *
72
  *
72
  * @author Shane 'Dataforce' McCormack
73
  * @author Shane 'Dataforce' McCormack
73
  */
74
  */
74
-public class LoggingPlugin extends Plugin implements ActionListener {
75
+public class LoggingPlugin extends Plugin implements ActionListener,
76
+        ConfigChangeListener {
75
 
77
 
76
     /** The command we registered. */
78
     /** The command we registered. */
77
     private LoggingCommand command;
79
     private LoggingCommand command;
80
+    /** Cached boolean settings. */
81
+    private boolean networkfolders, filenamehash, addtime, stripcodes,
82
+            channelmodeprefix, autobackbuffer, backbufferTimestamp, usedate;
83
+    /** Cached string settings. */
84
+    private String timestamp, usedateformat, logDirectory, colour;
85
+    /** Cached int settings. */
86
+    private int historyLines, backbufferLines;
78
 
87
 
79
     /** Open File */
88
     /** Open File */
80
     protected class OpenFile {
89
     protected class OpenFile {
81
 
90
 
91
+        /** Last used time. */
82
         public long lastUsedTime = System.currentTimeMillis();
92
         public long lastUsedTime = System.currentTimeMillis();
83
 
93
 
94
+        /** Open file's writer. */
84
         public BufferedWriter writer = null;
95
         public BufferedWriter writer = null;
85
 
96
 
97
+        /**
98
+         * Creates a new open file.
99
+         *
100
+         * @param writer Writer that has file open
101
+         */
86
         public OpenFile(final BufferedWriter writer) {
102
         public OpenFile(final BufferedWriter writer) {
87
             this.writer = writer;
103
             this.writer = writer;
88
         }
104
         }
117
      */
133
      */
118
     @Override
134
     @Override
119
     public void onLoad() {
135
     public void onLoad() {
120
-        final File dir = new File(IdentityManager.getGlobalConfig().getOption(getDomain(), "general.directory"));
136
+        final File dir = new File(logDirectory);
121
         if (dir.exists()) {
137
         if (dir.exists()) {
122
             if (!dir.isDirectory()) {
138
             if (!dir.isDirectory()) {
123
                 Logger.userError(ErrorLevel.LOW, "Unable to create logging dir (file exists instead)");
139
                 Logger.userError(ErrorLevel.LOW, "Unable to create logging dir (file exists instead)");
128
             }
144
             }
129
         }
145
         }
130
 
146
 
147
+        setCachedSettings();
148
+        IdentityManager.getGlobalConfig().addChangeListener(getDomain(), this);
149
+
131
         command = new LoggingCommand();
150
         command = new LoggingCommand();
132
         ActionManager.addListener(this,
151
         ActionManager.addListener(this,
133
                 CoreActionType.CHANNEL_OPENED,
152
                 CoreActionType.CHANNEL_OPENED,
191
      */
210
      */
192
     @Override
211
     @Override
193
     public void onUnload() {
212
     public void onUnload() {
194
-        idleFileTimer.cancel();
195
-        idleFileTimer.purge();
213
+        if (idleFileTimer != null) {
214
+            idleFileTimer.cancel();
215
+            idleFileTimer.purge();
216
+        }
196
 
217
 
197
         CommandManager.unregisterCommand(command);
218
         CommandManager.unregisterCommand(command);
198
         ActionManager.removeListener(this);
219
         ActionManager.removeListener(this);
258
 
279
 
259
         if (parser == null) {
280
         if (parser == null) {
260
             // Without a parser object, we might not be able to find the file to log this to.
281
             // Without a parser object, we might not be able to find the file to log this to.
261
-            if (IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "general.networkfolders")) {
282
+            if (networkfolders) {
262
                 // We *wont* be able to, so rather than logging to an incorrect file we just won't log.
283
                 // We *wont* be able to, so rather than logging to an incorrect file we just won't log.
263
                 return;
284
                 return;
264
             }
285
             }
271
 
292
 
272
         switch (type) {
293
         switch (type) {
273
             case QUERY_OPENED:
294
             case QUERY_OPENED:
274
-                if (IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "backbuffer.autobackbuffer")) {
295
+                if (autobackbuffer) {
275
                     showBackBuffer(query.getFrame(), filename);
296
                     showBackBuffer(query.getFrame(), filename);
276
                 }
297
                 }
277
 
298
 
326
 
347
 
327
         switch (type) {
348
         switch (type) {
328
             case CHANNEL_OPENED:
349
             case CHANNEL_OPENED:
329
-                if (IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "backbuffer.autobackbuffer")) {
350
+                if (autobackbuffer) {
330
                     showBackBuffer(chan.getFrame(), filename);
351
                     showBackBuffer(chan.getFrame(), filename);
331
                 }
352
                 }
332
 
353
 
449
         }
470
         }
450
     }
471
     }
451
 
472
 
473
+    /** {@inheritDoc} */
474
+    @Override
475
+    public void configChanged(String domain, String key) {
476
+        setCachedSettings();
477
+    }
478
+
452
     /**
479
     /**
453
      * Add a backbuffer to a frame.
480
      * Add a backbuffer to a frame.
454
      *
481
      *
456
      * @param filename File to get backbuffer from
483
      * @param filename File to get backbuffer from
457
      */
484
      */
458
     protected void showBackBuffer(final Window frame, final String filename) {
485
     protected void showBackBuffer(final Window frame, final String filename) {
459
-        final int numLines = IdentityManager.getGlobalConfig().getOptionInt(getDomain(), "backbuffer.lines");
460
-        final String colour = IdentityManager.getGlobalConfig().getOption(getDomain(), "backbuffer.colour");
461
-        final boolean showTimestamp = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "backbuffer.timestamp");
462
         if (frame == null) {
486
         if (frame == null) {
463
             Logger.userError(ErrorLevel.LOW, "Given a null frame");
487
             Logger.userError(ErrorLevel.LOW, "Given a null frame");
464
             return;
488
             return;
472
                 // is returned by getLines. To counter this, we call getLines(1) and do
496
                 // is returned by getLines. To counter this, we call getLines(1) and do
473
                 // nothing with the output.
497
                 // nothing with the output.
474
                 file.getLines(1);
498
                 file.getLines(1);
475
-                final Stack<String> lines = file.getLines(numLines);
499
+                final Stack<String> lines = file.getLines(backbufferLines);
476
                 while (!lines.empty()) {
500
                 while (!lines.empty()) {
477
-                    frame.addLine(getColouredString(colour, lines.pop()), showTimestamp);
501
+                    frame.addLine(getColouredString(colour, lines.pop()), backbufferTimestamp);
478
                 }
502
                 }
479
                 file.close();
503
                 file.close();
480
-                frame.addLine(getColouredString(colour, "--- End of backbuffer\n"), showTimestamp);
504
+                frame.addLine(getColouredString(colour, "--- End of backbuffer\n"), backbufferTimestamp);
481
             } catch (FileNotFoundException e) {
505
             } catch (FileNotFoundException e) {
482
                 Logger.userError(ErrorLevel.LOW, "Unable to show backbuffer (Filename: " + filename + "): " + e.getMessage());
506
                 Logger.userError(ErrorLevel.LOW, "Unable to show backbuffer (Filename: " + filename + "): " + e.getMessage());
483
             } catch (IOException e) {
507
             } catch (IOException e) {
545
     protected boolean appendLine(final String filename, final String line) {
569
     protected boolean appendLine(final String filename, final String line) {
546
         final StringBuffer finalLine = new StringBuffer();
570
         final StringBuffer finalLine = new StringBuffer();
547
 
571
 
548
-        if (IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "general.addtime")) {
572
+        if (addtime) {
549
             String dateString;
573
             String dateString;
550
-            final String dateFormatString = IdentityManager.getGlobalConfig().getOption(getDomain(), "general.timestamp");
551
             try {
574
             try {
552
-                final DateFormat dateFormat = new SimpleDateFormat(dateFormatString);
575
+                final DateFormat dateFormat = new SimpleDateFormat(timestamp);
553
                 dateString = dateFormat.format(new Date()).trim();
576
                 dateString = dateFormat.format(new Date()).trim();
554
             } catch (IllegalArgumentException iae) {
577
             } catch (IllegalArgumentException iae) {
555
                 // Default to known good format
578
                 // Default to known good format
556
                 final DateFormat dateFormat = new SimpleDateFormat("[dd/MM/yyyy HH:mm:ss]");
579
                 final DateFormat dateFormat = new SimpleDateFormat("[dd/MM/yyyy HH:mm:ss]");
557
                 dateString = dateFormat.format(new Date()).trim();
580
                 dateString = dateFormat.format(new Date()).trim();
558
 
581
 
559
-                Logger.userError(ErrorLevel.LOW, "Dateformat String '" + dateFormatString + "' is invalid. For more information: http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html");
582
+                Logger.userError(ErrorLevel.LOW, "Dateformat String '" + timestamp + "' is invalid. For more information: http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html");
560
             }
583
             }
561
             finalLine.append(dateString);
584
             finalLine.append(dateString);
562
             finalLine.append(" ");
585
             finalLine.append(" ");
563
         }
586
         }
564
 
587
 
565
-        if (IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "general.stripcodes")) {
588
+        if (stripcodes) {
566
             finalLine.append(Styliser.stipControlCodes(line));
589
             finalLine.append(Styliser.stipControlCodes(line));
567
         } else {
590
         } else {
568
             finalLine.append(line);
591
             finalLine.append(line);
605
         final StringBuffer file = new StringBuffer();
628
         final StringBuffer file = new StringBuffer();
606
         String md5String = "";
629
         String md5String = "";
607
 
630
 
608
-        directory.append(IdentityManager.getGlobalConfig().getOption(getDomain(), "general.directory"));
631
+        directory.append(logDirectory);
609
         if (directory.charAt(directory.length() - 1) != File.separatorChar) {
632
         if (directory.charAt(directory.length() - 1) != File.separatorChar) {
610
             directory.append(File.separatorChar);
633
             directory.append(File.separatorChar);
611
         }
634
         }
631
             md5String = obj.toString();
654
             md5String = obj.toString();
632
         }
655
         }
633
 
656
 
634
-        if (IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "advanced.usedate")) {
635
-            final String dateFormat = IdentityManager.getGlobalConfig().getOption(getDomain(), "advanced.usedateformat");
657
+        if (usedate) {
658
+            final String dateFormat = usedateformat;
636
             final String dateDir = (new SimpleDateFormat(dateFormat)).format(new Date());
659
             final String dateDir = (new SimpleDateFormat(dateFormat)).format(new Date());
637
             directory.append(dateDir);
660
             directory.append(dateDir);
638
             if (directory.charAt(directory.length() - 1) != File.separatorChar) {
661
             if (directory.charAt(directory.length() - 1) != File.separatorChar) {
644
             }
667
             }
645
         }
668
         }
646
 
669
 
647
-        if (IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "advanced.filenamehash")) {
670
+        if (filenamehash) {
648
             file.append('.');
671
             file.append('.');
649
             file.append(md5(md5String));
672
             file.append(md5(md5String));
650
         }
673
         }
663
      * @param networkName Name of network
686
      * @param networkName Name of network
664
      */
687
      */
665
     protected void addNetworkDir(final StringBuffer directory, final StringBuffer file, final String networkName) {
688
     protected void addNetworkDir(final StringBuffer directory, final StringBuffer file, final String networkName) {
666
-        if (!IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "general.networkfolders")) {
689
+        if (!networkfolders) {
667
             return;
690
             return;
668
         }
691
         }
669
 
692
 
761
      * @return name to display
784
      * @return name to display
762
      */
785
      */
763
     protected String getDisplayName(final ChannelClientInfo channelClient, final String overrideNick) {
786
     protected String getDisplayName(final ChannelClientInfo channelClient, final String overrideNick) {
764
-        final boolean addModePrefix = (IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "general.channelmodeprefix"));
765
-
766
         if (channelClient == null) {
787
         if (channelClient == null) {
767
             return (overrideNick.isEmpty()) ? "Unknown Client" : overrideNick;
788
             return (overrideNick.isEmpty()) ? "Unknown Client" : overrideNick;
768
         } else if (overrideNick.isEmpty()) {
789
         } else if (overrideNick.isEmpty()) {
769
-            return (addModePrefix) ? channelClient.toString() : channelClient.getClient().getNickname();
790
+            return channelmodeprefix ? channelClient.toString() : channelClient.getClient().getNickname();
770
         } else {
791
         } else {
771
-            return (addModePrefix) ? channelClient.getImportantModePrefix() + overrideNick : overrideNick;
792
+            return channelmodeprefix ? channelClient.getImportantModePrefix() + overrideNick : overrideNick;
772
         }
793
         }
773
     }
794
     }
774
 
795
 
812
             return false;
833
             return false;
813
         }
834
         }
814
 
835
 
815
-        new HistoryWindow("History", reader, target,
816
-                IdentityManager.getGlobalConfig().getOptionInt(getDomain(), "history.lines"));
836
+        new HistoryWindow("History", reader, target, historyLines);
817
 
837
 
818
         return true;
838
         return true;
819
     }
839
     }
820
 
840
 
841
+    /** Updates cached settings. */
842
+    public void setCachedSettings() {
843
+        networkfolders = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "general.networkfolders");
844
+        filenamehash = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "advanced.filenamehash");
845
+        addtime = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "general.addtime");
846
+        stripcodes = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "general.stripcodes");
847
+        channelmodeprefix = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "general.channelmodeprefix");
848
+        autobackbuffer = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "backbuffer.autobackbuffer");
849
+        backbufferTimestamp = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "backbuffer.timestamp");
850
+        usedate = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "advanced.usedate");
851
+        timestamp = IdentityManager.getGlobalConfig().getOption(getDomain(), "general.timestamp");
852
+        usedateformat = IdentityManager.getGlobalConfig().getOption(getDomain(), "advanced.usedateformat");
853
+        historyLines = IdentityManager.getGlobalConfig().getOptionInt(getDomain(), "history.lines");
854
+        colour = IdentityManager.getGlobalConfig().getOption(getDomain(), "backbuffer.colour");
855
+        backbufferLines = IdentityManager.getGlobalConfig().getOptionInt(getDomain(), "backbuffer.lines");
856
+        logDirectory = IdentityManager.getGlobalConfig().getOption(getDomain(), "general.directory");
857
+    }
858
+
821
 }
859
 }

+ 11
- 8
src/com/dmdirc/addons/parser_twitter/Twitter.java View File

153
     /** Map to store misc stuff in. */
153
     /** Map to store misc stuff in. */
154
     private Map<Object, Object> myMap = new HashMap<Object, Object>();
154
     private Map<Object, Object> myMap = new HashMap<Object, Object>();
155
 
155
 
156
+    /** Debug enabled. */
157
+    private boolean debugEnabled;
158
+
156
     /**
159
     /**
157
      * Create a new Twitter Parser!
160
      * Create a new Twitter Parser!
158
      *
161
      *
172
         
175
         
173
         resetState(true);
176
         resetState(true);
174
 
177
 
178
+        debugEnabled = getConfigManager().getOptionBool(myPlugin.getDomain(), "debugEnabled");
175
         if (getConfigManager().hasOptionString(myPlugin.getDomain(), "api.address."+myServerName)) {
179
         if (getConfigManager().hasOptionString(myPlugin.getDomain(), "api.address."+myServerName)) {
176
             this.apiAddress = getConfigManager().getOption(myPlugin.getDomain(), "api.address."+myServerName);
180
             this.apiAddress = getConfigManager().getOption(myPlugin.getDomain(), "api.address."+myServerName);
177
         } else {
181
         } else {
834
      * @param message Content of the message.
838
      * @param message Content of the message.
835
      */
839
      */
836
     private void doDebug(final Debug code, final String message) {
840
     private void doDebug(final Debug code, final String message) {
837
-        final boolean debug = getConfigManager().getOptionBool(myPlugin.getDomain(), "debugEnabled");
838
-        if (debug) {
841
+        if (debugEnabled) {
839
             getCallbackManager().getCallbackType(DebugInfoListener.class).call(code.ordinal(), message);
842
             getCallbackManager().getCallbackType(DebugInfoListener.class).call(code.ordinal(), message);
840
         }
843
         }
841
     }
844
     }
873
         currentParsers.add(this);
876
         currentParsers.add(this);
874
         api.addErrorHandler(this);
877
         api.addErrorHandler(this);
875
         api.addRawHandler(this);
878
         api.addRawHandler(this);
876
-        api.setDebug(getConfigManager().getOptionBool(myPlugin.getDomain(), "debugEnabled"));
879
+        api.setDebug(debugEnabled);
877
 
880
 
878
         getConfigManager().addChangeListener(myPlugin.getDomain(), this);
881
         getConfigManager().addChangeListener(myPlugin.getDomain(), this);
879
 
882
 
1281
     /** {@inheritDoc} */
1284
     /** {@inheritDoc} */
1282
     @Override
1285
     @Override
1283
     public void handleTwitterError(final TwitterAPI api, final Throwable t, final String source, final String twitterInput, final String twitterOutput, final String message) {
1286
     public void handleTwitterError(final TwitterAPI api, final Throwable t, final String source, final String twitterInput, final String twitterOutput, final String message) {
1284
-        final boolean debug = getConfigManager().getOptionBool(myPlugin.getDomain(), "debugEnabled");
1285
-        final boolean hide500Errors = !debug && getConfigManager().getOptionBool(myPlugin.getDomain(), "hide500Errors");
1287
+        final boolean hide500Errors = !debugEnabled && getConfigManager().getOptionBool(myPlugin.getDomain(), "hide500Errors");
1286
         if (hide500Errors && message.matches("^\\(50[0-9]\\).*")) { return; }
1288
         if (hide500Errors && message.matches("^\\(50[0-9]\\).*")) { return; }
1287
         try {
1289
         try {
1288
             if (!message.isEmpty()) {
1290
             if (!message.isEmpty()) {
1289
-                twitterFail("Recieved an error from twitter: " + message + (debug ? " [" + source + "]" : ""));
1290
-            } else if (debug) {
1291
+                twitterFail("Recieved an error from twitter: " + message + (debugEnabled ? " [" + source + "]" : ""));
1292
+            } else if (debugEnabled) {
1291
                 twitterFail("Recieved an error: " + source);
1293
                 twitterFail("Recieved an error: " + source);
1292
             }
1294
             }
1293
             if (t != null) {
1295
             if (t != null) {
1395
     public void configChanged(final String domain, final String key) {
1397
     public void configChanged(final String domain, final String key) {
1396
         if (domain.equalsIgnoreCase(myPlugin.getDomain())) {
1398
         if (domain.equalsIgnoreCase(myPlugin.getDomain())) {
1397
             if (key.equalsIgnoreCase("debugEnabled")) {
1399
             if (key.equalsIgnoreCase("debugEnabled")) {
1398
-                api.setDebug(getConfigManager().getOptionBool(myPlugin.getDomain(), "debugEnabled"));
1400
+                debugEnabled = getConfigManager().getOptionBool(myPlugin.getDomain(), "debugEnabled");
1401
+                api.setDebug(debugEnabled);
1399
             } else if (key.equalsIgnoreCase("autoAt")) {
1402
             } else if (key.equalsIgnoreCase("autoAt")) {
1400
                 sendPrivateNotice("'autoAt' setting was changed, reconnect needed.");
1403
                 sendPrivateNotice("'autoAt' setting was changed, reconnect needed.");
1401
                 disconnect("'autoAt' setting was changed, reconnect needed.");
1404
                 disconnect("'autoAt' setting was changed, reconnect needed.");

+ 0
- 2
src/com/dmdirc/addons/parser_twitter/api/TwitterMessage.java View File

22
 
22
 
23
 package com.dmdirc.addons.parser_twitter.api;
23
 package com.dmdirc.addons.parser_twitter.api;
24
 
24
 
25
-import java.text.ParseException;
26
-import java.text.SimpleDateFormat;
27
 import org.w3c.dom.Element;
25
 import org.w3c.dom.Element;
28
 import org.w3c.dom.Node;
26
 import org.w3c.dom.Node;
29
 import org.w3c.dom.NodeList;
27
 import org.w3c.dom.NodeList;

+ 0
- 1
src/com/dmdirc/addons/parser_twitter/api/commons/StringEscapeUtils.java View File

19
 import java.io.IOException;
19
 import java.io.IOException;
20
 import java.io.StringWriter;
20
 import java.io.StringWriter;
21
 import java.io.Writer;
21
 import java.io.Writer;
22
-import java.util.Locale;
23
 
22
 
24
 /**
23
 /**
25
  * <p>Escapes and unescapes <code>String</code>s for
24
  * <p>Escapes and unescapes <code>String</code>s for

+ 14
- 9
src/com/dmdirc/addons/windowstatus/WindowStatusPlugin.java View File

57
 
57
 
58
     /** The panel we use in the status bar. */
58
     /** The panel we use in the status bar. */
59
     private final WindowStatusPanel panel = new WindowStatusPanel();
59
     private final WindowStatusPanel panel = new WindowStatusPanel();
60
+    private boolean showname, shownone;
61
+    private String nonePrefix;
60
 
62
 
61
     /** Creates a new instance of WindowStatusPlugin. */
63
     /** Creates a new instance of WindowStatusPlugin. */
62
     public WindowStatusPlugin() {
64
     public WindowStatusPlugin() {
70
     public void onLoad() {
72
     public void onLoad() {
71
         Main.getUI().getStatusBar().addComponent(panel);
73
         Main.getUI().getStatusBar().addComponent(panel);
72
         IdentityManager.getGlobalConfig().addChangeListener(getDomain(), this);
74
         IdentityManager.getGlobalConfig().addChangeListener(getDomain(), this);
73
-        updateStatus();
75
+        updateCache();
74
 
76
 
75
         ActionManager.addListener(this, CoreActionType.CLIENT_FRAME_CHANGED);
77
         ActionManager.addListener(this, CoreActionType.CLIENT_FRAME_CHANGED);
76
     }
78
     }
98
         }
100
         }
99
     }
101
     }
100
 
102
 
103
+    private void updateCache() {
104
+        showname = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "client.showname");
105
+        shownone = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "channel.shownone");
106
+        nonePrefix = IdentityManager.getGlobalConfig().getOption(getDomain(), "channel.noneprefix");
107
+        updateStatus();
108
+    }
109
+
101
     /**
110
     /**
102
      * Update the window status using the current active window.
111
      * Update the window status using the current active window.
103
      */
112
      */
139
 
148
 
140
                 if (!names.containsKey(im)) {
149
                 if (!names.containsKey(im)) {
141
                     if (mode.isEmpty()) {
150
                     if (mode.isEmpty()) {
142
-                        if (IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "channel.shownone")) {
143
-                            if (IdentityManager.getGlobalConfig().hasOptionString(getDomain(), "channel.noneprefix")) {
144
-                                mode = IdentityManager.getGlobalConfig().getOption(getDomain(), "channel.noneprefix");
145
-                            } else {
146
-                                mode = "None:";
147
-                            }
151
+                        if (shownone) {
152
+                            mode = nonePrefix;
148
                         } else {
153
                         } else {
149
                             continue;
154
                             continue;
150
                         }
155
                         }
179
             final Query frame = (Query) current;
184
             final Query frame = (Query) current;
180
 
185
 
181
             textString.append(frame.getHost());
186
             textString.append(frame.getHost());
182
-            if (IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "client.showname") && frame.getServer().getParser() != null) {
187
+            if (showname && frame.getServer().getParser() != null) {
183
                 final ClientInfo client = frame.getServer().getParser().getClient(frame.getHost());
188
                 final ClientInfo client = frame.getServer().getParser().getClient(frame.getHost());
184
                 final String realname = client.getRealname();
189
                 final String realname = client.getRealname();
185
                 if (!realname.isEmpty()) {
190
                 if (!realname.isEmpty()) {
214
     /** {@inheritDoc} */
219
     /** {@inheritDoc} */
215
     @Override
220
     @Override
216
     public void configChanged(final String domain, final String key) {
221
     public void configChanged(final String domain, final String key) {
217
-        updateStatus();
222
+        updateCache();
218
     }
223
     }
219
 
224
 
220
 }
225
 }

Loading…
Cancel
Save