aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny van Heumen <danny@dannyvanheumen.nl>2014-11-18 21:59:39 +0100
committerDanny van Heumen <danny@dannyvanheumen.nl>2014-11-20 21:00:49 +0100
commit3eb7b3da0e95ed3c063656534428c74b4580764f (patch)
tree9ce8bc822713ba5e0b7b34d3c7d518b1bc65d6da
parentd750dab7987c4ea9272475fa7be33db98b5a8daf (diff)
downloadjitsi-3eb7b3da0e95ed3c063656534428c74b4580764f.zip
jitsi-3eb7b3da0e95ed3c063656534428c74b4580764f.tar.gz
jitsi-3eb7b3da0e95ed3c063656534428c74b4580764f.tar.bz2
Moved IRC command implementations to separate plugin package: irccommands
-rw-r--r--build.xml12
-rw-r--r--lib/felix.client.run.properties3
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/CommandFactory.java4
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/MessageManager.java17
-rw-r--r--src/net/java/sip/communicator/plugin/irccommands/IrcCommandsActivator.java80
-rw-r--r--src/net/java/sip/communicator/plugin/irccommands/command/Join.java (renamed from src/net/java/sip/communicator/impl/protocol/irc/command/Join.java)2
-rw-r--r--src/net/java/sip/communicator/plugin/irccommands/command/Me.java (renamed from src/net/java/sip/communicator/impl/protocol/irc/command/Me.java)2
-rw-r--r--src/net/java/sip/communicator/plugin/irccommands/command/Mode.java (renamed from src/net/java/sip/communicator/impl/protocol/irc/command/Mode.java)2
-rw-r--r--src/net/java/sip/communicator/plugin/irccommands/command/Msg.java (renamed from src/net/java/sip/communicator/impl/protocol/irc/command/Msg.java)2
-rw-r--r--src/net/java/sip/communicator/plugin/irccommands/command/Nick.java (renamed from src/net/java/sip/communicator/impl/protocol/irc/command/Nick.java)2
-rw-r--r--src/net/java/sip/communicator/plugin/irccommands/command/package-info.java12
-rw-r--r--src/net/java/sip/communicator/plugin/irccommands/irccommands.manifest.mf10
-rw-r--r--src/net/java/sip/communicator/plugin/irccommands/package-info.java (renamed from src/net/java/sip/communicator/impl/protocol/irc/command/package-info.java)6
-rw-r--r--test/net/java/sip/communicator/plugin/irccommands/command/JoinTest.java (renamed from test/net/java/sip/communicator/impl/protocol/irc/command/JoinTest.java)2
-rw-r--r--test/net/java/sip/communicator/plugin/irccommands/command/MeTest.java (renamed from test/net/java/sip/communicator/impl/protocol/irc/command/MeTest.java)2
-rw-r--r--test/net/java/sip/communicator/plugin/irccommands/command/ModeTest.java (renamed from test/net/java/sip/communicator/impl/protocol/irc/command/ModeTest.java)2
-rw-r--r--test/net/java/sip/communicator/plugin/irccommands/command/MsgTest.java (renamed from test/net/java/sip/communicator/impl/protocol/irc/command/MsgTest.java)2
-rw-r--r--test/net/java/sip/communicator/plugin/irccommands/command/NickTest.java (renamed from test/net/java/sip/communicator/impl/protocol/irc/command/NickTest.java)2
18 files changed, 131 insertions, 33 deletions
diff --git a/build.xml b/build.xml
index 99603a9..9ba1dbb 100644
--- a/build.xml
+++ b/build.xml
@@ -1054,7 +1054,7 @@
bundle-icq-slick,bundle-mock,bundle-smacklib,bundle-jmdnslib,
bundle-jabber,bundle-jabber-slick,bundle-swing-ui,bundle-ui-service,
bundle-jnalib,bundle-phonenumbers,
- bundle-irc-api,bundle-irc,bundle-plugin-ircaccregwizz,
+ bundle-irc-api,bundle-irc,bundle-irc-commands,bundle-plugin-ircaccregwizz,
bundle-msn,bundle-msn-slick,bundle-yahoo,bundle-yahoo-slick,
bundle-contactlist,meta-contactlist,meta-contactlist-slick,
bundle-plugin-icqaccregwizz,bundle-plugin-jabberaccregwizz,
@@ -2098,6 +2098,16 @@ javax.swing.event, javax.swing.border"/>
</jar>
</target>
+ <!-- BUNDLE-IRC-COMMANDS -->
+ <target name="bundle-irc-commands" depends="bundle-irc">
+ <!-- Creates a bundle containing the IRC impl of the protocol provider.-->
+ <jar compress="false" destfile="${bundles.dest}/irc-commands.jar"
+ manifest="${src}/net/java/sip/communicator/plugin/irccommands/irccommands.manifest.mf">
+ <zipfileset dir="${dest}/net/java/sip/communicator/plugin/irccommands"
+ prefix="net/java/sip/communicator/plugin/irccommands"/>
+ </jar>
+ </target>
+
<!-- BUNDLE IRC-API -->
<target name="bundle-irc-api" depends="bundle-slf4j">
<copy file="${lib.noinst}/irc-api-1.0.jar" tofile="${bundles.dest}/irc-api-1.0.jar"/>
diff --git a/lib/felix.client.run.properties b/lib/felix.client.run.properties
index 239d97b..d840743 100644
--- a/lib/felix.client.run.properties
+++ b/lib/felix.client.run.properties
@@ -132,7 +132,8 @@ felix.auto.start.52= \
reference:file:sc-bundles/reconnectplugin.jar
felix.auto.start.55= \
- reference:file:sc-bundles/meta-cl.jar
+ reference:file:sc-bundles/meta-cl.jar \
+ reference:file:sc-bundles/irc-commands.jar
felix.auto.start.60= \
reference:file:sc-bundles/history.jar \
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/CommandFactory.java b/src/net/java/sip/communicator/impl/protocol/irc/CommandFactory.java
index 5266156..77630a2 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/CommandFactory.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/CommandFactory.java
@@ -93,8 +93,8 @@ public class CommandFactory
it.remove();
if (LOGGER.isDebugEnabled())
{
- LOGGER.debug("Unregistered command '" + command + "' ("
- + type.toString() + ")");
+ LOGGER.debug("Unregistered command '" + entry.getKey()
+ + "' (" + type.toString() + ")");
}
}
}
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/MessageManager.java b/src/net/java/sip/communicator/impl/protocol/irc/MessageManager.java
index ba32402..c33b4db 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/MessageManager.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/MessageManager.java
@@ -6,7 +6,6 @@
*/
package net.java.sip.communicator.impl.protocol.irc;
-import net.java.sip.communicator.impl.protocol.irc.command.*;
import net.java.sip.communicator.impl.protocol.irc.exception.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
@@ -24,8 +23,6 @@ import com.ircclouds.irc.api.state.*;
* TODO Implement messaging service for offline messages and such. (MemoServ -
* message relaying services)
*
- * TODO move IRC commands to separate package
- *
* @author Danny van Heumen
*/
public class MessageManager
@@ -47,20 +44,6 @@ public class MessageManager
private static final int IRC_PROTOCOL_MAXIMUM_MESSAGE_SIZE = 510;
/**
- * Register some basic commands immediately so that these are guaranteed to
- * be available.
- */
- static
- {
- CommandFactory.registerCommand("me", Me.class);
- CommandFactory.registerCommand("msg", Msg.class);
- CommandFactory.registerCommand("join", Join.class);
- CommandFactory.registerCommand("nick", Nick.class);
- CommandFactory.registerCommand("mode",
- net.java.sip.communicator.impl.protocol.irc.command.Mode.class);
- }
-
- /**
* IrcConnection instance.
*/
private final IrcConnection connection;
diff --git a/src/net/java/sip/communicator/plugin/irccommands/IrcCommandsActivator.java b/src/net/java/sip/communicator/plugin/irccommands/IrcCommandsActivator.java
new file mode 100644
index 0000000..6572446
--- /dev/null
+++ b/src/net/java/sip/communicator/plugin/irccommands/IrcCommandsActivator.java
@@ -0,0 +1,80 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.plugin.irccommands;
+
+import java.util.*;
+import java.util.Map.Entry;
+
+import net.java.sip.communicator.impl.protocol.irc.*;
+import net.java.sip.communicator.plugin.irccommands.command.*;
+import net.java.sip.communicator.plugin.irccommands.command.Mode;
+
+import org.osgi.framework.*;
+
+/**
+ * Activator of the IRC commands plugin.
+ *
+ * @author Danny van Heumen
+ */
+public class IrcCommandsActivator
+ implements BundleActivator
+{
+ /**
+ * Map of command-implementation mapping for IRC {@link Command}
+ * implementations.
+ *
+ * This map is used as reference when registering and unregistering the
+ * commands upon (resp.) starting and stopping the plugin bundle.
+ */
+ private static final Map<String, Class<? extends Command>> COMMANDS;
+
+ /**
+ * Building the commands registration reference.
+ */
+ static
+ {
+ HashMap<String, Class<? extends Command>> commands =
+ new HashMap<String, Class<? extends Command>>();
+ commands.put("me", Me.class);
+ commands.put("msg", Msg.class);
+ commands.put("mode", Mode.class);
+ commands.put("nick", Nick.class);
+ commands.put("join", Join.class);
+ COMMANDS = Collections.unmodifiableMap(commands);
+ }
+
+ /**
+ * Stopping the bundle.
+ *
+ * @param context the bundle context
+ */
+ @Override
+ public void stop(final BundleContext context)
+ {
+ final Set<Class<? extends Command>> implementations =
+ new HashSet<Class<? extends Command>>(COMMANDS.values());
+ for (Class<? extends Command> impl : implementations)
+ {
+ CommandFactory.unregisterCommand(impl, null);
+ }
+ }
+
+ /**
+ * Starting the bundle.
+ *
+ * @param context the bundle context
+ */
+ @Override
+ public void start(final BundleContext context)
+ {
+ for (Entry<String, Class<? extends Command>> entry : COMMANDS
+ .entrySet())
+ {
+ CommandFactory.registerCommand(entry.getKey(), entry.getValue());
+ }
+ }
+}
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/command/Join.java b/src/net/java/sip/communicator/plugin/irccommands/command/Join.java
index 5d92d16..20c9c72 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/command/Join.java
+++ b/src/net/java/sip/communicator/plugin/irccommands/command/Join.java
@@ -4,7 +4,7 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.impl.protocol.irc.command;
+package net.java.sip.communicator.plugin.irccommands.command;
import net.java.sip.communicator.impl.protocol.irc.*;
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/command/Me.java b/src/net/java/sip/communicator/plugin/irccommands/command/Me.java
index 52997e1..cbbb869 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/command/Me.java
+++ b/src/net/java/sip/communicator/plugin/irccommands/command/Me.java
@@ -4,7 +4,7 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.impl.protocol.irc.command;
+package net.java.sip.communicator.plugin.irccommands.command;
import net.java.sip.communicator.impl.protocol.irc.*;
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/command/Mode.java b/src/net/java/sip/communicator/plugin/irccommands/command/Mode.java
index 1d70e6e..f738ae6 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/command/Mode.java
+++ b/src/net/java/sip/communicator/plugin/irccommands/command/Mode.java
@@ -4,7 +4,7 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.impl.protocol.irc.command;
+package net.java.sip.communicator.plugin.irccommands.command;
import net.java.sip.communicator.impl.protocol.irc.*;
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/command/Msg.java b/src/net/java/sip/communicator/plugin/irccommands/command/Msg.java
index 2bfec0e..7e10659 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/command/Msg.java
+++ b/src/net/java/sip/communicator/plugin/irccommands/command/Msg.java
@@ -4,7 +4,7 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.impl.protocol.irc.command;
+package net.java.sip.communicator.plugin.irccommands.command;
import net.java.sip.communicator.impl.protocol.irc.*;
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/command/Nick.java b/src/net/java/sip/communicator/plugin/irccommands/command/Nick.java
index 3cc99c5..39582cd 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/command/Nick.java
+++ b/src/net/java/sip/communicator/plugin/irccommands/command/Nick.java
@@ -4,7 +4,7 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.impl.protocol.irc.command;
+package net.java.sip.communicator.plugin.irccommands.command;
import net.java.sip.communicator.impl.protocol.irc.*;
diff --git a/src/net/java/sip/communicator/plugin/irccommands/command/package-info.java b/src/net/java/sip/communicator/plugin/irccommands/command/package-info.java
new file mode 100644
index 0000000..5327958
--- /dev/null
+++ b/src/net/java/sip/communicator/plugin/irccommands/command/package-info.java
@@ -0,0 +1,12 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+/**
+ * Package containing implementations of IRC commands.
+ *
+ * @author Danny van Heumen
+ */
+package net.java.sip.communicator.plugin.irccommands.command;
diff --git a/src/net/java/sip/communicator/plugin/irccommands/irccommands.manifest.mf b/src/net/java/sip/communicator/plugin/irccommands/irccommands.manifest.mf
new file mode 100644
index 0000000..9ba9858
--- /dev/null
+++ b/src/net/java/sip/communicator/plugin/irccommands/irccommands.manifest.mf
@@ -0,0 +1,10 @@
+Bundle-Activator: net.java.sip.communicator.plugin.irccommands.IrcCommandsActivator
+Bundle-Name: IRC commands
+Bundle-Description: IRC commands package
+Bundle-Vendor: jitsi.org
+Bundle-Version: 0.0.1
+Bundle-SymbolicName: net.java.sip.communicator.plugin.irccommands
+Import-Package: org.osgi.framework,
+ net.java.sip.communicator.util,
+ net.java.sip.communicator.impl.protocol.irc,
+ com.ircclouds.irc.api
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/command/package-info.java b/src/net/java/sip/communicator/plugin/irccommands/package-info.java
index 1c857f6..70ba8e8 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/command/package-info.java
+++ b/src/net/java/sip/communicator/plugin/irccommands/package-info.java
@@ -5,6 +5,8 @@
* See terms of license at gnu.org.
*/
/**
- * Implementations of IRC commands.
+ * Plugin providing IRC commands for the IRC protocol.
+ *
+ * @author Danny van Heumen
*/
-package net.java.sip.communicator.impl.protocol.irc.command;
+package net.java.sip.communicator.plugin.irccommands;
diff --git a/test/net/java/sip/communicator/impl/protocol/irc/command/JoinTest.java b/test/net/java/sip/communicator/plugin/irccommands/command/JoinTest.java
index 1e56f55..5547614 100644
--- a/test/net/java/sip/communicator/impl/protocol/irc/command/JoinTest.java
+++ b/test/net/java/sip/communicator/plugin/irccommands/command/JoinTest.java
@@ -4,7 +4,7 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.impl.protocol.irc.command;
+package net.java.sip.communicator.plugin.irccommands.command;
import junit.framework.*;
import net.java.sip.communicator.impl.protocol.irc.*;
diff --git a/test/net/java/sip/communicator/impl/protocol/irc/command/MeTest.java b/test/net/java/sip/communicator/plugin/irccommands/command/MeTest.java
index 5987d85..770c04f 100644
--- a/test/net/java/sip/communicator/impl/protocol/irc/command/MeTest.java
+++ b/test/net/java/sip/communicator/plugin/irccommands/command/MeTest.java
@@ -4,7 +4,7 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.impl.protocol.irc.command;
+package net.java.sip.communicator.plugin.irccommands.command;
import junit.framework.*;
import net.java.sip.communicator.impl.protocol.irc.*;
diff --git a/test/net/java/sip/communicator/impl/protocol/irc/command/ModeTest.java b/test/net/java/sip/communicator/plugin/irccommands/command/ModeTest.java
index fd6b910..8d4177c 100644
--- a/test/net/java/sip/communicator/impl/protocol/irc/command/ModeTest.java
+++ b/test/net/java/sip/communicator/plugin/irccommands/command/ModeTest.java
@@ -4,7 +4,7 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.impl.protocol.irc.command;
+package net.java.sip.communicator.plugin.irccommands.command;
import junit.framework.*;
import net.java.sip.communicator.impl.protocol.irc.*;
diff --git a/test/net/java/sip/communicator/impl/protocol/irc/command/MsgTest.java b/test/net/java/sip/communicator/plugin/irccommands/command/MsgTest.java
index 67adf1d..422105d 100644
--- a/test/net/java/sip/communicator/impl/protocol/irc/command/MsgTest.java
+++ b/test/net/java/sip/communicator/plugin/irccommands/command/MsgTest.java
@@ -4,7 +4,7 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.impl.protocol.irc.command;
+package net.java.sip.communicator.plugin.irccommands.command;
import junit.framework.*;
import net.java.sip.communicator.impl.protocol.irc.*;
diff --git a/test/net/java/sip/communicator/impl/protocol/irc/command/NickTest.java b/test/net/java/sip/communicator/plugin/irccommands/command/NickTest.java
index 494f86e..9593185 100644
--- a/test/net/java/sip/communicator/impl/protocol/irc/command/NickTest.java
+++ b/test/net/java/sip/communicator/plugin/irccommands/command/NickTest.java
@@ -4,7 +4,7 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.impl.protocol.irc.command;
+package net.java.sip.communicator.plugin.irccommands.command;
import junit.framework.*;
import net.java.sip.communicator.impl.protocol.irc.*;