powered by Jive Software

Openfire transport plugin

Hi everyone! Nice to be here (couse it’s my first post).

I have a trivial problem that I can’t solve (in fact i could cope with it, but it would take ages). I want to create a transport for Openfire that is something like command line. For example I write “help” and it gives appropriate answer. Simply: request - response. There will be huge backend with databases etc, but that’s not a problem for now. A have browsed IM gateway plugin sources, but big amound of files that is don’t understand (I’m very net to Java and Openfire) doesn’t help me at all. The one thing I need is a snippet of code that simply works (creates a transport). The rest is for me

A tip: I don’t wont to add a transport to my list by browsing services of my XMPP server in my client, but I want it “out of box” (every single new user gets this transport to the list automatically). If that problem has been solved before, sorry, I couldn’t find it

Regards and thanks in advance.

It sounds like what you are really after is the concept of a “bot” than a transport. Bots typically are something you can send an IM to and communicate with and they probably provide some service. You should be able to do that via openfire’s plugin interface (or write a standalone thing that just connects to your openfire server like any other user that folk communicate with). Looking at my IM gateway code is going to be faaaar more than you’ll need to worry about. =) I would recommend starting the developer docs here: http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/plugin-d ev-guide.html

And the openfire java docs here:

http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/javadoc/ index.html

And looking at the Component interface, specifically processPacket for the real meat of it. You could also accomplish something similar with a PacketInterceptor, but frankly I think it would be easier and accomplish your goal quicker to go with a Component. You might have to fight with it just a bit to prevent it from showing up in the services browsing, and you should be able to accomplish adding it to folk’s rosters a number of ways… you could work with the shared group and force it that way … you could listen for new users and auto-add it via one of openfire’s listeners. (UserEventListener)

I would also recommend looking at the broadcast plugin source from openfire’s own source tree. It fits into one source file, and has “some” similar concepts to what it sounds like you are after.

@jadestorm: thanks for quick answer. Yeah, you’re right, the thing I’m talking about is more bot than transport. I was thinking about this word while writing the post :stuck_out_tongue: You’re still right, I’m going to write something standalone that handles all the backend stuff and gives simple text response. So, now I’m to struggle a little with Java (struggle couse I’m quite new to this language). Oh, and the links you posted, thanks, I know them very well

Actually, I’m creating multiplayer game and I decided to use XMPP for handling communication. It’s going to be strategy based on events. And the “bot” is to give users possibility of creating their own “remote controllers” (sorry, I don’t know proper word for this) as plugins for any Jabber clients. I also create my own client (Java+smack) that hides all the communication stuff and focuses on logic of the game. That’s enough for explenation

I’ll post results of my fight, thanks