powered by Jive Software

Component writing

Hi, All !

I tried to write new messenger compontnt - MSN gateway.

I extended my java class from BasicModule, and it work(It received discovery requests, etc.

I redefine getTrackInfo() :

protected TrackInfo getTrackInfo() {

TrackInfo trackInfo = new TrackInfo();

trackInfo.getTrackerClasses().put(PacketRouter.class, “router”);

trackInfo.getTrackerClasses().put(PacketDeliverer.class, “deliverer”);

trackInfo.getTrackerClasses().put(PresenceManager.class, “presenceManager”);

trackInfo.getTrackerClasses().put(PacketFactory.class, “packetFactory”);

trackInfo.getTrackerClasses().put(IQRegisterHandler.class, “RegisterHandler”);

trackInfo.getTrackerClasses().put(RoutingTable.class, “RoutingTable”);

return trackInfo;

}

and define new route entry :

public void setRoutingTable(final RoutingTable routingTable) {

routingTable.addRoute("msn.myserver, this);

}

and define register handler :

public void setRegisterHandler(final IQRegisterHandler registerHandler) {

registerHandler.addDelegate(

“msn.myserver”,

new IQMsnRegisterHandler(this)

);

}

There are some new questions.

  1. Some packets received by void process(XMPPPacket xmppPacket) method. But subscribe packets didn’'t receive. I think, it is problem in messenger core(see PresenceSubscribeHandler.process). How can I setup messenger for process ALL packets to “msn.myserver” by my own module ?

  2. How should I send packets to user ? I see 2 possible methods: PacketRouter.route and PacketDeliverer.deliver. Which one should I use ?

WBR, Alex.

I investigated first problem.

SocketReadThread reads packets, parse packet type(message, presence, iq) and run route for readed packet type. For example, for Presence packets it runs PacketRouterImpl.route(Presence).

Seems to it is wrong way, because it should route packets based on route table.

So, all handlers should be registered only on own XMPPAddress, and shouldn’'t process all packets.