powered by Jive Software

Great software, I'm hooked

First of all, I’d like to thank the team behind openfire and all the libraries that come with it. I just came accross it in search for the right architecture to model my usecase, truly great piece of software!

I’m a newbie, but like to do things correctly from the start. The usecase is as follows:

User A sends a message over XMPP to a bot; the user himself does not know who this message is destined for (the bot decides that). The bot routes the message to user B who can then decide whether or not to start a chatsession with user A. Users do not have rosters, the only resource they know should be the bot.

I’m not sure what the best architecture would be to implement this usecase?

  1. Should the bot be set up as just another XMPP client? Ideally, I’d like to minimize network traffic and have the bot live inside the openfire server.

  2. I’ve thought of reworking the PacketListener to become the bot. It would intercept all Messages, decide who User B should be and send User B the message on behalf of User A. Is this the way to go?

Thanks,

  • monadx
  1. I’ve thought of reworking the PacketListener to become the bot. It
    would intercept all Messages, decide who User B should be and send User
    B the message on behalf of User A. Is this the way to go?
    I think so. You can write a plugin which does intercept all packets going through the server, using the PacketInterceptor interface. When intercepting packets in while preprocessing, you can easily reroute them. Just set a new “to”-field for that packet.

Your bot inside the server needs to simulate client and server at the same time. This is important to get presence and subscription correctly working for your bot. You could check the source code of the Helga-Bot to see how to do that.