External component doesn't receive packets

Hi,

I’ve been trying to integrate to OpenFire in order to catch users’ logging in and messages sent. I need this to create log entries in a different system.

Based on several tutorials, I created an external component with Whack and the OpenFire API by extending AbstractComponent. The code is below, A is the main class and Test is the component.

However, I’m only getting packets sent directly to the plugin’s domain, not the other packets (when users log in, send messages and so on). I’m using Spark as the client, and Spark doesn’t seem to allow me to set a specific domain when logging a user in.

Can anyone point me in the right direction?


import org.jivesoftware.whack.ExternalComponentManager;
import org.xmpp.component.ComponentException;

public class A {
public static void main(String[] args) {
try {
ExternalComponentManager mgr = new ExternalComponentManager(“localhost”, 5275);
mgr.setSecretKey(“plugin”, “password”);
mgr.addComponent(“plugin”, new Test());

  while (true) {
    try {
      Thread.sleep(10000);
     
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }
 
} catch (ComponentException e) {
  e.printStackTrace();
}

}
}

import org.xmpp.component.AbstractComponent;
import org.xmpp.packet.Message;
import org.xmpp.packet.Presence;

public class Test extends AbstractComponent {
@Override
public String getDescription() {
return getName();
}

@Override
public String getName() {
return “Test Chat Plugin”;
}

@Override
protected void handleMessage(Message message) {
System.out.println(getJID() + " message: " + message);
}

@Override
protected void handlePresence(Presence presence) {
System.out.println(getJID() + " presence: " + presence);
}
}