|
@@ -29,6 +29,8 @@ import com.dmdirc.Query;
|
29
|
29
|
import com.dmdirc.Server;
|
30
|
30
|
import com.dmdirc.actions.CoreActionType;
|
31
|
31
|
import com.dmdirc.interfaces.actions.ActionType;
|
|
32
|
+import com.dmdirc.config.ConfigManager;
|
|
33
|
+import com.dmdirc.config.Identity;
|
32
|
34
|
import com.dmdirc.config.IdentityManager;
|
33
|
35
|
import com.dmdirc.config.prefs.PluginPreferencesCategory;
|
34
|
36
|
import com.dmdirc.config.prefs.PreferencesCategory;
|
|
@@ -87,6 +89,10 @@ public class LoggingPlugin extends BasePlugin implements ActionListener,
|
87
|
89
|
private final PluginInfo pluginInfo;
|
88
|
90
|
/** The action controller to use. */
|
89
|
91
|
private final ActionController actionController;
|
|
92
|
+ /** Global config. */
|
|
93
|
+ private final ConfigManager config;
|
|
94
|
+ /** Addon identity. */
|
|
95
|
+ private final Identity identity;
|
90
|
96
|
|
91
|
97
|
/** Timer used to close idle files. */
|
92
|
98
|
protected Timer idleFileTimer;
|
|
@@ -105,20 +111,23 @@ public class LoggingPlugin extends BasePlugin implements ActionListener,
|
105
|
111
|
* @param actionController The action controller to register listeners with
|
106
|
112
|
*/
|
107
|
113
|
public LoggingPlugin(final PluginInfo pluginInfo,
|
108
|
|
- final ActionController actionController) {
|
|
114
|
+ final ActionController actionController,
|
|
115
|
+ final IdentityManager identityManager) {
|
109
|
116
|
super();
|
110
|
117
|
|
111
|
118
|
this.pluginInfo = pluginInfo;
|
112
|
119
|
this.actionController = actionController;
|
|
120
|
+ config = identityManager.getGlobalConfiguration();
|
|
121
|
+ identity = identityManager.getGlobalAddonIdentity();
|
113
|
122
|
|
114
|
|
- registerCommand(new LoggingCommand(), LoggingCommand.INFO);
|
|
123
|
+ registerCommand(new LoggingCommand(this), LoggingCommand.INFO);
|
115
|
124
|
}
|
116
|
125
|
|
117
|
126
|
/** {@inheritDoc} */
|
118
|
127
|
@Override
|
119
|
128
|
public void domainUpdated() {
|
120
|
|
- IdentityManager.getAddonIdentity().setOption(getDomain(),
|
121
|
|
- "general.directory", Main.getConfigDir() + "logs" + System.getProperty("file.separator"));
|
|
129
|
+ identity.setOption(getDomain(), "general.directory",
|
|
130
|
+ Main.getConfigDir() + "logs" + System.getProperty("file.separator"));
|
122
|
131
|
}
|
123
|
132
|
|
124
|
133
|
/**
|
|
@@ -139,7 +148,7 @@ public class LoggingPlugin extends BasePlugin implements ActionListener,
|
139
|
148
|
}
|
140
|
149
|
}
|
141
|
150
|
|
142
|
|
- IdentityManager.getGlobalConfig().addChangeListener(getDomain(), this);
|
|
151
|
+ config.addChangeListener(getDomain(), this);
|
143
|
152
|
|
144
|
153
|
actionController.registerListener(this,
|
145
|
154
|
CoreActionType.CHANNEL_OPENED,
|
|
@@ -350,9 +359,9 @@ public class LoggingPlugin extends BasePlugin implements ActionListener,
|
350
|
359
|
final String overrideNick = isME ? getDisplayName(parser.getLocalClient()) : "";
|
351
|
360
|
|
352
|
361
|
if (type == CoreActionType.QUERY_MESSAGE || type == CoreActionType.QUERY_SELF_MESSAGE) {
|
353
|
|
- appendLine(filename, "<%s> %s", getDisplayName(client, overrideNick), (String) arguments[2]);
|
|
362
|
+ appendLine(filename, "<%s> %s", getDisplayName(client, overrideNick), arguments[2]);
|
354
|
363
|
} else {
|
355
|
|
- appendLine(filename, "* %s %s", getDisplayName(client, overrideNick), (String) arguments[2]);
|
|
364
|
+ appendLine(filename, "* %s %s", getDisplayName(client, overrideNick), arguments[2]);
|
356
|
365
|
}
|
357
|
366
|
break;
|
358
|
367
|
}
|
|
@@ -865,20 +874,20 @@ public class LoggingPlugin extends BasePlugin implements ActionListener,
|
865
|
874
|
|
866
|
875
|
/** Updates cached settings. */
|
867
|
876
|
public void setCachedSettings() {
|
868
|
|
- networkfolders = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "general.networkfolders");
|
869
|
|
- filenamehash = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "advanced.filenamehash");
|
870
|
|
- addtime = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "general.addtime");
|
871
|
|
- stripcodes = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "general.stripcodes");
|
872
|
|
- channelmodeprefix = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "general.channelmodeprefix");
|
873
|
|
- autobackbuffer = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "backbuffer.autobackbuffer");
|
874
|
|
- backbufferTimestamp = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "backbuffer.timestamp");
|
875
|
|
- usedate = IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "advanced.usedate");
|
876
|
|
- timestamp = IdentityManager.getGlobalConfig().getOption(getDomain(), "general.timestamp");
|
877
|
|
- usedateformat = IdentityManager.getGlobalConfig().getOption(getDomain(), "advanced.usedateformat");
|
878
|
|
- historyLines = IdentityManager.getGlobalConfig().getOptionInt(getDomain(), "history.lines");
|
879
|
|
- colour = IdentityManager.getGlobalConfig().getOption(getDomain(), "backbuffer.colour");
|
880
|
|
- backbufferLines = IdentityManager.getGlobalConfig().getOptionInt(getDomain(), "backbuffer.lines");
|
881
|
|
- logDirectory = IdentityManager.getGlobalConfig().getOption(getDomain(), "general.directory");
|
|
877
|
+ networkfolders = config.getOptionBool(getDomain(), "general.networkfolders");
|
|
878
|
+ filenamehash = config.getOptionBool(getDomain(), "advanced.filenamehash");
|
|
879
|
+ addtime = config.getOptionBool(getDomain(), "general.addtime");
|
|
880
|
+ stripcodes = config.getOptionBool(getDomain(), "general.stripcodes");
|
|
881
|
+ channelmodeprefix = config.getOptionBool(getDomain(), "general.channelmodeprefix");
|
|
882
|
+ autobackbuffer = config.getOptionBool(getDomain(), "backbuffer.autobackbuffer");
|
|
883
|
+ backbufferTimestamp = config.getOptionBool(getDomain(), "backbuffer.timestamp");
|
|
884
|
+ usedate = config.getOptionBool(getDomain(), "advanced.usedate");
|
|
885
|
+ timestamp = config.getOption(getDomain(), "general.timestamp");
|
|
886
|
+ usedateformat = config.getOption(getDomain(), "advanced.usedateformat");
|
|
887
|
+ historyLines = config.getOptionInt(getDomain(), "history.lines");
|
|
888
|
+ colour = config.getOption(getDomain(), "backbuffer.colour");
|
|
889
|
+ backbufferLines = config.getOptionInt(getDomain(), "backbuffer.lines");
|
|
890
|
+ logDirectory = config.getOption(getDomain(), "general.directory");
|
882
|
891
|
}
|
883
|
892
|
|
884
|
893
|
/** Open File. */
|