1 /*****************************************************/
2 /* This java file is a part of the */
4 /* - Plouf's Java IRC Client - */
6 /* Copyright (C) 2002 - 2005 Philippe Detournay */
8 /* All contacts : theplouf@yahoo.com */
10 /* PJIRC is free software; you can redistribute */
11 /* it and/or modify it under the terms of the GNU */
12 /* General Public License as published by the */
13 /* Free Software Foundation; version 2 or later of */
16 /* PJIRC is distributed in the hope that it will */
17 /* be useful, but WITHOUT ANY WARRANTY; without */
18 /* even the implied warranty of MERCHANTABILITY or */
19 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
20 /* General Public License for more details. */
22 /* You should have received a copy of the GNU */
23 /* General Public License along with PJIRC; if */
24 /* not, write to the Free Software Foundation, */
25 /* Inc., 59 Temple Place, Suite 330, Boston, */
26 /* MA 02111-1307 USA */
28 /*****************************************************/
32 import irc.IRCApplication;
33 import irc.IRCConfiguration;
38 * The root class for all plugins.
40 public abstract class Plugin {
43 * The global IRCConfiguration instance.
45 protected IRCConfiguration _ircConfiguration;
47 * The running IRCApplication instance.
49 protected IRCApplication _ircApplication;
52 * Create a new Plugin with the given IRCConfiguration instance.
54 * @param ircConfiguration
55 * the global IRCConfiguration instance.
57 public Plugin(IRCConfiguration ircConfiguration) {
58 _ircConfiguration = ircConfiguration;
62 * Set the running IRCApplication instance.
64 * @param ircApplication
65 * the running IRCApplication.
67 public void setIRCApplication(IRCApplication ircApplication) {
68 _ircApplication = ircApplication;
75 // default empty implementation...
79 * Unload any ressources used by this plugin. This should be the last method
80 * call on the instance.
82 public void unload() {
83 _ircConfiguration = null;
84 _ircApplication = null;
88 * Notify this plugin that a new source has been created.
91 * the newly created source.
93 * is true if the newly created source should gain immediate focus,
94 * false is no particular action is to be taken.
96 public void sourceCreated(Source source, Boolean bring) {
97 // default empty implementation...
101 * Notify this plugin that an existing source has been removed. No further
102 * call should be performed on this source.
105 * the removed source.
107 public void sourceRemoved(Source source) {
108 // default empty implementation...
112 * Notify this plugin that a new server has been created.
115 * the newly created server.
117 public void serverCreated(Server s) {
118 // default empty implementation...
122 * Notify this plugin that an existing server has acheived connection to its
128 public void serverConnected(Server s) {
129 // default empty implementation...
133 * Notify this plugin that an existing server has disconnected from its remote
137 * disconnected server.
139 public void serverDisconnected(Server s) {
140 // default empty implementation...
144 * Notify this plugin that an existing server has been removed. No further
145 * call should be performed on this server.
150 public void serverRemoved(Server s) {
151 // default empty implementation...
155 * Notify this plugin that an external event has been triggered on it.
160 public void externalEvent(Object event) {
161 // default empty implementation...
165 * Get the value from the name.
169 * @return the plugin value for this name.
171 public Object getValue(Object name) {