Browse Source

Add Skeleton nick keep plugin.

pull/313/head
Greg Holmes 9 years ago
parent
commit
0cd6909ba5

+ 22
- 0
nickkeep/plugin.config View File

@@ -0,0 +1,22 @@
1
+# This is a DMDirc configuration file.
2
+
3
+# This section indicates which sections below take key/value
4
+# pairs, rather than a simple list. It should be placed above
5
+# any sections that take key/values.
6
+keysections:
7
+  metadata
8
+  updates
9
+  version
10
+
11
+metadata:
12
+  author=Greg <greg@dmdirc.com>
13
+  mainclass=com.dmdirc.addons.nickkeep.NickKeepPlugin
14
+  description=Keeps your primary nickname
15
+  name=nickkeep
16
+  nicename=Nick keep plugin
17
+
18
+updates:
19
+  id=78
20
+
21
+version:
22
+  friendly=0.1

+ 41
- 0
nickkeep/src/com/dmdirc/addons/nickkeep/NickKeepManager.java View File

@@ -0,0 +1,41 @@
1
+/*
2
+ * Copyright (c) 2006-2015 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.nickkeep;
24
+
25
+import javax.inject.Inject;
26
+
27
+/**
28
+ * Provides Nick Keep support in DMDirc.
29
+ */
30
+public class NickKeepManager {
31
+
32
+    @Inject
33
+    public NickKeepManager() {
34
+    }
35
+
36
+    public void load() {
37
+    }
38
+
39
+    public void unload() {
40
+    }
41
+}

+ 55
- 0
nickkeep/src/com/dmdirc/addons/nickkeep/NickKeepModule.java View File

@@ -0,0 +1,55 @@
1
+/*
2
+ * Copyright (c) 2006-2015 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.nickkeep;
24
+
25
+import com.dmdirc.ClientModule;
26
+import com.dmdirc.plugins.PluginDomain;
27
+import com.dmdirc.plugins.PluginInfo;
28
+
29
+import dagger.Module;
30
+import dagger.Provides;
31
+
32
+/**
33
+ * Dagger injection module for the Nick Keep plugin
34
+ */
35
+@Module(injects = NickKeepModule.class, addsTo = ClientModule.class)
36
+public class NickKeepModule {
37
+
38
+    private final PluginInfo pluginInfo;
39
+
40
+    public NickKeepModule(final PluginInfo pluginInfo) {
41
+        this.pluginInfo = pluginInfo;
42
+    }
43
+
44
+    @Provides
45
+    @PluginDomain(NickKeepPlugin.class)
46
+    public String getSettingsDomain() {
47
+        return pluginInfo.getDomain();
48
+    }
49
+
50
+    @Provides
51
+    @PluginDomain(NickKeepPlugin.class)
52
+    public PluginInfo getPluginInfo() {
53
+        return pluginInfo;
54
+    }
55
+}

+ 54
- 0
nickkeep/src/com/dmdirc/addons/nickkeep/NickKeepPlugin.java View File

@@ -0,0 +1,54 @@
1
+/*
2
+ * Copyright (c) 2006-2015 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.nickkeep;
24
+
25
+import com.dmdirc.plugins.PluginInfo;
26
+import com.dmdirc.plugins.implementations.BasePlugin;
27
+
28
+import dagger.ObjectGraph;
29
+
30
+/**
31
+ * Plugin to provide Nick Keep support to DMDirc.
32
+ */
33
+public class NickKeepPlugin extends BasePlugin {
34
+
35
+    private NickKeepManager manager;
36
+
37
+    @Override
38
+    public void load(final PluginInfo pluginInfo, final ObjectGraph graph) {
39
+        super.load(pluginInfo, graph);
40
+
41
+        setObjectGraph(graph.plus(new NickKeepModule(pluginInfo)));
42
+        manager = getObjectGraph().get(NickKeepManager.class);
43
+    }
44
+
45
+    @Override
46
+    public void onLoad() {
47
+        manager.load();
48
+    }
49
+
50
+    @Override
51
+    public void onUnload() {
52
+        manager.unload();
53
+    }
54
+}

+ 35
- 0
nickkeep/test/com/dmdirc/addons/nickkeep/NickKeepManagerTest.java View File

@@ -0,0 +1,35 @@
1
+/*
2
+ * Copyright (c) 2006-2015 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.nickkeep;
24
+
25
+import org.junit.Before;
26
+import org.junit.runner.RunWith;
27
+import org.mockito.runners.MockitoJUnitRunner;
28
+
29
+@RunWith(MockitoJUnitRunner.class)
30
+public class NickKeepManagerTest {
31
+
32
+    @Before
33
+    public void setUp() throws Exception {
34
+    }
35
+}

Loading…
Cancel
Save