Hi all
I wrote a plugin that filters the specific outgoing messages.
Once the user enters some key words, then the text of the transcription window will be recoreded.
The below is parts of my plugin.
I’'m sure that the plugin can be installed well.
And the message filter can be activated.
private void installMessageFilter() {
// Retrieve the ChatManager from SparkManager
final String JID = sm.getUsername();
MessageFilter messageFilter = new MessageFilter() {
public void filterOutgoing(final Message message) {
String currentBody = message.getBody();
if(currentBody.startsWith("@ssm@")){
int answer = JOptionPane.showConfirmDialog(null, “Record the former messages?”, “Record the former messages?”, JOptionPane.YES_NO_OPTION);
if(answer == 0){
ChatRoom room = chatManager.getChatRoom(sm.getJID()).getChatRoom();
And the below is the debugging log:
Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at com.jivesoftware.spark.ChatManager.getChatRoom(ChatManager.java:149)
at com.jivesoftware.ssm.Ssm$1.filterOutgoing(Ssm.java:37)
at com.jivesoftware.spark.ChatManager.filterOutgoingMessage(ChatManager.java:228)
at com.jivesoftware.spark.ui.rooms.ChatRoomImpl.sendMessage(ChatRoomImpl.java:260)
at com.jivesoftware.spark.ui.rooms.ChatRoomImpl.sendMessage(ChatRoomImpl.java:245)
at com.jivesoftware.spark.ui.ChatRoom.checkForEnter(ChatRoom.java:462)
at com.jivesoftware.spark.ui.ChatRoom.access$300(ChatRoom.java:67)
at com.jivesoftware.spark.ui.ChatRoom$7.keyPressed(ChatRoom.java:272)
at java.awt.Component.processKeyEvent(Component.java:5446)
It looks like the problem is going to be happened when I invoke the funcion: getChatRoom()
Please give some adivces.
Thanks!