From: Daryl V. H. <dva...@sf...> - 2005-05-13 18:55:18
|
It should be under csjava.chatbot.*, though if you're viewing the CVS tree through SourceForge's viewer, it's csjava.csjava.chatbot.*. There are three files, MessageListener.java, JabberBotFramework.java, & JabberBotTest.java. The version numbers (if you need them) are 1.3, 1.2, & 1.1, respectively. I don't think that changing it from threaded to event-listening would be too hard, I'd just have to change it a little bit. I noticed I also need to add some more JavaDoc comments to indicate what certain methods do. I should be updating it some soon. The demo I have does exactly what you suggested, though I think I might be able to make it a little more interesting by sending something like "You sent this:", then whatever they sent. Suggestions as to what it should do would be appreciated, although I don't have much experience with text-based user interaction. Daryl. Toby Donaldson wrote: > 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. >> >> > > > -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.9 - Release Date: 12/05/05 |