powered by Jive Software

Simple chat bot working only once

Hello

To get used to smack API i created a chatbot that connects to a particular user and send him a message. Next it will resend anything the person send it. This is done 3 times in a while loop after which the bot exits It also prints the senders messages on the screen. The problem is this works fine once but thereafter it doesn’'t work…that is it will send the starting welcome message to the user but will not reply to nor display the users messages. I have to restart the wildfire for it to work

i am posting the code snippet here

while(i<3)

{

Message message=newChat.nextMessage();

System.out.println(newChat.getParticipant()*":"*message.getBody());

newChat.sendMessage(message.getBody());

i++;

}

there is nothing much before this…just connecting and setting message subject and sending the first welcome message.

Also the debugger shows receipt of the users’’ messages but none sent from bot. I short its like the bot is stuck after sending the first message

Would appreciate any sort of help

Thanks

Aggie