From: Toby D. <tj...@sf...> - 2005-05-13 18:08:24
|
Daryl, I just updated from the CVS tree, and I don't see the Jabber code. Where should I look for it? I think it's probably simpler to use events instead of threads for the asynchronous chatting, if you know what I mean. Treat the messages that come from the Jabber server like events. The Smack library should have support for this. Also, I've been chatting with a Surrey high school IT teacher about running a Turing Test contest using Jabber, and if a demo is ready I'd like to let him try it (i.e. at least chat to it). Toby Daryl Van Humbeck wrote: > Hi, all! > > The Jabber chatbot framework is now at a state of some usefulness, you > can log-in to a server, listen for messages and send messages. > > It uses Jivesoft's Smack toolkit (which made the framework code _much_ > smaller), so you'll need to download it and point the projects > classpath to two of the files, smack.jar and smackx.jar, in order to > use the program. > > Just so you know, the test program logs into jabber.org, so if only > one person uses the bot unaltered, it will log into jabber.org with > the username "csjavaChatBot," and everyone can chat with it. > > I probably shouldn't have used threads to listen for messages, but I > hadn't been sure of how it works, so I'll probably change it later. > > To log into a server, just create a new instance of > JabberBotFramework, using the host name, username, and password (and > optionally, port) that you want to use. > The constructor will throw an org.jivesoft.smack.XMPPException if a > problem occurrs, so you need to catch it. > > For examples, look at the file JabberBotTest.java in the same package > as the JabberBotFramework, csjava.chatbot.*. > > To send a message, you just call .sendMessage(msg, to), where msg is > the String message to send, and to is the username to send it to. > > To listen for messages, add a MessageListener to your copy of the > JabberBotFramework with .addMessageListener(messageListener). > > That's basically it. If you want more functionality (it currently only > supports text messages), please post saying so. > Though I'm not sure how to recieve HTML, etc. messages. > > Anyway, here it is. > > Daryl. > > |