powered by Jive Software

Sparkplug Developer Kit Released!

Hello All,

The new Sparkplug Developer Kit has been released. To learn more about how to build your own Sparkplugs, take a look at http://www.jivesoftware.org/spark/sparkplug_kit.jsp.

I look forward to seeing some new plugins

Cheers,

Derek

You guys are great! Thank you so much for Spark 1.1.

I am already cracking away at a “keyword” finding plugin for conference rooms. It’‘s set up and deploying correctly (because I added the AddTab feature for testing and it works fine). However, the conference room isn’'t flashing every time it receives a message. Any help on this?

Thanks,

Tim

package com.jivesoftware.spark.sparkwords;

import javax.swing.JButton;

import javax.swing.JTabbedPane;

import com.jivesoftware.spark.plugin.Plugin;

import com.jivesoftware.spark.*;

import com.jivesoftware.spark.ui.*;

import org.jivesoftware.smack.packet.Message;

public class sparkwords implements Plugin {

public void initialize() {

addTabToSpark();

addListenertoChatRoom();

}

public void shutdown() {

}

public boolean canShutDown() {

return true;

}

public void uninstall(){

}

private void addTabToSpark(){

// Get Workspace UI from SparkManager

Workspace workspace = SparkManager.getWorkspace();

// Retrieve the Tabbed Pane from the WorkspaceUI.

JTabbedPane tabbedPane = workspace.getWorkspacePane();

// Add own Tab.

tabbedPane.addTab(“My Plugin”, new JButton(“Hello”));

}

private void addListenertoChatRoom() {

final MessageListener listenee = new MessageListener() {

public void messageReceived(ChatRoom room, Message message) {

ChatManager chateManager = SparkManager.getChatManager();

ChatContainer chateContainer = chateManager.getChatContainer();

chateContainer.startFlashing(room);

System.out.println(“Found something”);

}

public void messageSent(ChatRoom room, Message message) {

}

};

ChatManager chatManager = SparkManager.getChatManager();

chatManager.addChatRoomListener(new ChatRoomListenerAdapter() {

public void chatRoomOpened(ChatRoom room) {

room.addMessageListener(listenee);

}

public void chatRoomLeft(ChatRoom room) {

room.removeMessageListener(listenee);

}

});

}

}

Hi Tim,

It will only flash if the ChatFrame is out of focus and needs attention. This will occur by default without needing to add your own messagelistener.

Cheers,

Derek

Derek,

Thanks a lot. I understand what you are saying. I got the code working well, and it includes a toaster popup for messages. It should be good.

I am now setting up a preferences item. If I understand right, there is no “store” of preferences (i.e. plugin preferences can’'t be saved with the regular Spark preferences). Can you elaborate more on that? How exactly does that work? Do the preferences have to be committed at initialization every time the plugin loads by pulling them from a file?

Also, how do you get previously committed preferences? I am a little confused on the whole namespace issue.

And one final question. Any suggestions on the best way to set the room within which the keyword is detected for the user to see? I tried the flash, as mentioned, but that doesn’'t work as I had thought. I really need it to get their attention, as most users have 3-5 rooms open, so they need to know which one alerted them with the toaster.

Thanks,

Tim

Let’'s move this discussion over to the Sparkplugs Forum