Quote plugin

This is my first plugin. That’s why please leave comments here if something wrong.

this plugin quotes selected text from Chat. If there are no selected text into chat it will quote last sended or recieved message.

For now it has only 2 languages. English & Russian.

Hi Konstantin

Your quote plugin is valuable for me.I also want to write spark plugin.But I am very newer about plugin.Can you help me about steps of making plugin for spark.Alought I used Sparkplug kit,it is not ok.Let me know how do you make quote plugin.Thank in advance.

You could contact me in gmail, jabber or skype. I’ll help. tell me where will be better for you, i’ll send you my contacts.

Thz in advance

Hi Konstantin

I make a plugin to appear button.At my spark,I made two class ‘Utf8PropertyResourceBundle.java and Utf8ResourceBundle.java’ to use my language at Spark.To appear my plugin button’s text,I make ‘Resoruce.java’ like your ‘QuoteResource.java’.When I run my plugin from command prompt,I get errors at Resource.java.

Where I wrong?Pls help me.Thank in advance.

Utf8ResourceBundle And Utf8PropertyResourceBundle should be in your plugin’s package.

For example :

Your package is com.examples

Then path to classes Utf8ResourceBundle And Utf8PropertyResourceBundle will be like this

com.examples.Utf8ResourceBundle And com.examples.Utf8PropertyResourceBundle

If this classes will be into org.jivesoftware.resource

you need to build all spark sources.

Try to replace this classes.

Thank a lot for your help.I don’t have errors with your instructions.I also have two properties files.But my plugin work for test_i18n.properties(for english language).Don’t work for test_i18n_mm.properties(for my language).Alought change spark’s IM language,my plugin’s text appear from test_i18n.properties.Don’t appear from test_i18n_mm.properties.Where will I wrong?Pls help me again.Thank in advance.

This files will work only with i18n tags for example for Russian it will be test_i18n_ru_Ru.properties or est_i18n_ru.properties. If such file didn’t find, java will use default file test_i18n.properties

What is your language ?

Yes,I use i18n tags for my properties files like that test_i18n_ru.properties.But do not work.How it can be?Thank for your quick reply.

Try to find full code of language. for ex. For russian short code is “ru” and full is “ru_RU”

Or you can check locale of your client.

Hi Constantin~

I want to make myplugin. so I read some articles and find your plugin.

first of all, my English ability is very low.

I wonder something your plugin.

first, how do I test your plugin?

I try to add your quote.jar file in Program files/Spark/plugin. After that I start spark but I cannot see correct result.

second, I can’t build your plugin by ant in eclipse. I got some error.

I think different OS is the reason that occurs this problem…

If you don’t mind, please tell me how do you make your plugin.

my email is chaelimgo@sds.co.kr please help…

thanks

This plugin builds using spark builder.

If you have source finles of Spark. You need to open folder spark/build/builder there is file named “how-to-build.txt”

There is information how to build plugins.

If you want to use jar file. You must put it into directory “plugins”. Then into Spark menu -> Plugins must be Quote plugin.

Hi Konstantin,

First of all well done on your plugin - it is really useful!

I am new to Spark development and I am trying to implement my first sample plugin by following the guides presented in:

http://www.igniterealtime.org/builds/sparkplug_kit/docs/latest/sparkplug_dev_gui de.html

The problem that I am facing is that I am trying to build a simple plugin like the ones presented in the tutorial but I when I put the jar file of my plugin in in Spark’s plugins directory I cannot see it. I am using Eclipse to program the plugins and is there a way to try/debug the plugin that I am developing without putting the jar file in the Spark plugins directory, till I am sure that it has no bugs.

Also, in the initial steps of the tutorial where I am specified to do the following:

  • It is required that you use the 1.4 JRE to build Spark.

  • Add all *.jar files in the Sparkplugs/spark/lib and Sparkplugs/spark/lib/windows directories to your classpath.

  • Add the resource directory (Sparkplugins/spark/resource) to your classpath for the native libraries.

  • Main Class - org.jivesoftware.Spark

  • VM Parameters - -Dplugin=path_to_your_plugin.xml file. This allows you to run your plugins within your IDE without deploying.

  • That’s it.

  • the resources directory has to be put as you did in your Plugin?

Thanks a lot for your help and have a nice day.

If you have sources of spark. You could compile
it for plugins development using
**     ant development **
command.

Then you will have a platform where you could debug
and work with your newly created plugins.

you will see target/sparkplugs directory. And then you could follow steps you have seen into spark_plugs document.

Hi Konstantin,

First of all thanks for your reply I really appreciate it.

What I have done so far are the following steps:

  • It is required that you use the 1.4 JRE to build Spark.
  • Add all *.jar files in the Sparkplugs/spark/lib and Sparkplugs/spark/lib/windows directories to your classpath.
  • Add the resource directory (Sparkplugins/spark/resource) to your classpath for the native libraries.
  • Main Class - org.jivesoftware.Spark
  • VM Parameters - -Dplugin=path_to_your_plugin.xml file. This allows you to run your plugins within your IDE without deploying.
  • That’s it.
    I am not sure on the third option when I am asked to add the resource directory to my classpath. I added this to my project like I added the jar files that I found from the Sparkplugs/spark/lib and Sparkplugs/spark/lib/windows, is that correct?

I did not understand where I have to perform the ‘ant development’ command but in Eclipse I managed to add a new External Tools configuration so that when I want to package my project as a jar file I perform an Ant build by just press the Run -> External Tools -> Build All Plugins (this is the configuration that I added). And the project is being packaged correctly but when I input it into the plugins folder of Spark IM I am not being able to view my plugin. I have tried to log in and out several times but still I cannot see it.

In Eclipse I tried the first example of: http://www.igniterealtime.org/builds/sparkplug_kit/docs/latest/sparkplug_dev_gui de.html#simplePlugin

and in Eclipse it works where all the System.out.println are shown in console when I call a particular method.

On the otherhand I tried the second example: http://www.igniterealtime.org/builds/sparkplug_kit/docs/latest/sparkplug_dev_gui de.html#addTab

(where I replaced the JTabbedPane with SparkTabbedPane as it is in the examples.jar) and when I run it it gives me Null Pointer Exception.

Thus what I am asking is do you think that I am doing something wrong from what I told you, and will I be able to run my programs in Eclipse and check if they work before I try my plugin in Spark - since I am not being able to view the myplugin.jar that I enter.

Sorry for the long email and I appreciate your help.
myplugin.jar (7912373 Bytes)

Could you provide me Exception messages and if it is possible your plugins source code ?

About building spark plugins:

You could build them from park/build/builder. There will be how-to-build.txt with info about building plugins for spark. Try to build it from there.

P.S. You allways could find me into GTalk or ICQ. It will be faster ) I’ll provide you with my contacts into private message.

Hi Konstantin,

Thanks for your contact I sent you mine via a private message.

I tried to follow the how-to-build.txt but I did not understand the last step. But how I am still using the ANT script now to build my plugin into a jar file where the jar file is then placed in the builder folder.

The exception is as follows:

Exception in thread “main” java.lang.NullPointerException

at org.jivesoftware.spark.ui.status.StatusBar.(StatusBar.java:98)

at org.jivesoftware.spark.Workspace.(Workspace.java:166)

at org.jivesoftware.spark.Workspace.getInstance(Workspace.java:109)

at org.jivesoftware.spark.SparkManager.getWorkspace(SparkManager.java:213)

at org.jivesoftware.spark.ExamplePlugin.addTabToSpark(ExamplePlugin.java:87)

at org.jivesoftware.spark.ExamplePlugin.initialize(ExamplePlugin.java:50)

at org.jivesoftware.spark.SparkMain.main(SparkMain.java:11)

In my last message I uploaded a copy of how the plugin jar file is being packaged.

Thanks!