|
@@ -32,12 +32,14 @@ import com.dmdirc.config.InvalidIdentityFileException;
|
32
|
32
|
import com.dmdirc.logger.DMDircExceptionHandler;
|
33
|
33
|
import com.dmdirc.logger.ErrorLevel;
|
34
|
34
|
import com.dmdirc.logger.Logger;
|
|
35
|
+import com.dmdirc.plugins.PluginInfo;
|
35
|
36
|
import com.dmdirc.plugins.PluginManager;
|
36
|
37
|
import com.dmdirc.plugins.Service;
|
37
|
38
|
import com.dmdirc.ui.themes.ThemeManager;
|
38
|
39
|
import com.dmdirc.ui.interfaces.UIController;
|
39
|
40
|
import com.dmdirc.ui.WarningDialog;
|
40
|
41
|
import com.dmdirc.updater.UpdateChecker;
|
|
42
|
+import com.dmdirc.updater.Version;
|
41
|
43
|
import com.dmdirc.util.resourcemanager.ResourceManager;
|
42
|
44
|
|
43
|
45
|
import java.awt.GraphicsEnvironment;
|
|
@@ -113,6 +115,7 @@ public final class Main {
|
113
|
115
|
}
|
114
|
116
|
|
115
|
117
|
final PluginManager pm = PluginManager.getPluginManager();
|
|
118
|
+ checkBundledPlugins(pm, IdentityManager.getGlobalConfig());
|
116
|
119
|
|
117
|
120
|
ThemeManager.loadThemes();
|
118
|
121
|
|
|
@@ -258,6 +261,29 @@ public final class Main {
|
258
|
261
|
}
|
259
|
262
|
}
|
260
|
263
|
|
|
264
|
+ /**
|
|
265
|
+ * Checks whether the plugins bundled with this release of DMDirc are newer
|
|
266
|
+ * than the plugins known by the specified {@link PluginManager}. If the
|
|
267
|
+ * bundled plugins are newer, they are automatically extracted.
|
|
268
|
+ *
|
|
269
|
+ * @param pm The plugin manager to use to check plugins
|
|
270
|
+ * @param config The configuration source for bundled versions
|
|
271
|
+ */
|
|
272
|
+ private static void checkBundledPlugins(final PluginManager pm, final ConfigManager config) {
|
|
273
|
+ for (PluginInfo plugin : pm.getPluginInfos()) {
|
|
274
|
+ if (config.hasOptionString("bundledplugins_versions", plugin.getName())) {
|
|
275
|
+ final Version bundled = new Version(config.getOption("bundledplugins_versions",
|
|
276
|
+ plugin.getName()));
|
|
277
|
+ final Version installed = plugin.getVersion();
|
|
278
|
+
|
|
279
|
+ if (installed.compareTo(bundled) < 0) {
|
|
280
|
+ extractCorePlugins(plugin.getName());
|
|
281
|
+ PluginManager.getPluginManager().reloadPlugin(plugin.getFilename());
|
|
282
|
+ }
|
|
283
|
+ }
|
|
284
|
+ }
|
|
285
|
+ }
|
|
286
|
+
|
261
|
287
|
/**
|
262
|
288
|
* Attempts to find and activate a service which provides a UI that we
|
263
|
289
|
* can use.
|