1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.plugin.pircbot;
21
22 import javax.swing.Icon;
23
24 import org.xnap.gui.XNapFrame;
25 import org.xnap.gui.util.IconHelper;
26 import org.xnap.plugin.AbstractPlugin;
27
28 /***
29 * Provides an IRC chat plugin based on PircBot.
30 */
31 public class PircBotPlugin extends AbstractPlugin
32 {
33
34
35
36 public static String ICON_FILENAME = "socket.png";
37
38 public static Icon ICON_16
39 = IconHelper.getIcon(ICON_FILENAME, 16, false);
40
41
42
43
44 private static PircBotPlugin singleton;
45
46 private PircBotPanel jpPircBot;
47 private PircBotPreferences prefs;
48
49
50
51 public PircBotPlugin()
52 {
53 }
54
55
56
57 public static PircBotPlugin getInstance()
58 {
59 return singleton;
60 }
61
62 public PircBotPreferences getPreferences()
63 {
64 return prefs;
65 }
66
67 /***
68 * Starts the plugin.
69 */
70 public void start()
71 {
72 singleton = this;
73 prefs = new PircBotPreferences();
74 }
75
76 /***
77 * Starts the GUI of the plugin.
78 */
79 public void startGUI()
80 {
81 jpPircBot = new PircBotPanel();
82 XNapFrame.getInstance().insertTab
83 (getInfo().getName(),
84 IconHelper.getListIcon("socket.png"), jpPircBot);
85 }
86
87 /***
88 * Stops the plugin. Disposes all singletons.
89 */
90 public void stop()
91 {
92 prefs = null;
93 singleton = null;
94 }
95
96 /***
97 * Stops the GUI of the plugin.
98 */
99 public void stopGUI()
100 {
101 jpPircBot.savePrefs();
102
103 XNapFrame.getInstance().removeTab(jpPircBot);
104 jpPircBot = null;
105 }
106
107
108
109 }