Hi.
I saw another case containing the below error but I am quite confident that I am only logged in once and in one thread with the user credentials.
We have built an integration with the wordpress.com im service to be able to subscribe to feeds of interest.
The below arrives in the log about 10 sec after the “Hello there” statement.
2009-10-26 15:36:16.413 INFO com.tailsweep.crawling.xmpp.WordpressPubSub - Chat created with bot@im.wordpress.com
2009-10-26 15:36:16.759 INFO com.tailsweep.crawling.xmpp.WordpressPubSub - Bot says: Hello there! Can I help you?
stream:error (text)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:306)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)
I add the interesting code below:
public void init()
{
try
{
ConnectionConfiguration config = new ConnectionConfiguration(“im.wordpress.com”, 5222);
conn = new XMPPConnection(config);
conn.connect();
conn.login(“user”, “pwd”);
setupChatListener();
createBotChat();
Roster roster = conn.getRoster();
roster.setSubscriptionMode(Roster.SubscriptionMode.accept_all);
}
catch (XMPPException e)
{
log.error(e.toString(), e);
}
}
private void createBotChat() throws XMPPException
{
Chat newChat = conn.getChatManager().createChat("bot@im.wordpress.com", new MessageListener()
{
public void processMessage(Chat chat, Message message)
{
log.info("Bot says: " + message.getBody());
}
});
newChat.sendMessage(“hi”);
}
private void setupChatListener()
{
ChatManager chatmanager = conn.getChatManager();
chatmanager.addChatListener(new ChatManagerListener()
{
public void chatCreated(Chat chat, boolean b)
{
log.info("Chat created with “+chat.getParticipant());
if(!chat.getParticipant().startsWith("bot@im.wordpress.com”))
{
chat.addMessageListener(new MessageListener()
{
public void processMessage(Chat chat, Message message)
{
//Removed business code for clarity
}
});
}
}
});
}
Any clues ?
BYTW nice library, really straight forward.
Cheers
//Marcus Herou