hiiiii Iam new to smack.I created a client in java that connects to gtalk service.I wrote code so that when i get a incoming chat message a private window opens with the paricipant name on it.whenever i get a chat message from the same user,a new window is opening
class control implements ChatManagerListener
{
//basic stuff like connection and login
public void chatCreated(Chat chat, final boolean createdLocally)
{
pm=new pmessage(this,chat);//class that gives private window
}
}
class pmessage implements MessageListener,ActionListener
{
public pmessage(control c,Chat ch)
{
//basic stuff like window creation usung JFrame
MessageListener ml=new MessageListener()
{
public void processMessage(Chat chat, Message message)
{
if(message.getType() == Message.Type.chat)
lstUserList2.addElement(chat.getParticipant() + " says: " + message.getBody());
lstUserList2.addElement("\n");
}
};
ch.addMessageListener(ml);
}
//calls a method sendMessage when the send button is clicked
public void sendMessage(String to,String message) throws XMPPException
{
ch=connection.getChatManager().createChat(to,ml);
ch.sendMessage(message);
}
for each incoming message of the user and my message to the user, new windows are being created.
please help me so that for every user only one window will open and chat goes in that
IAM ATTACHING SCREEN SHOTS OF MY CLIENT