Perhaps the problem lies within the following:
Here is my code that allows a user to join an existing muc:
//ALLOW A USER TO JOIN AN EXISTING MULTI USER CHAT ROOM
public MultiUserChat joinExistingMUC(Object conn,String room_name)
{
MultiUserChat muc = null;
try
{
XMPPConnection connx = (XMPPConnection) conn;
muc = new MultiUserChat(connx,room_name+CONFERENCE_SERVICE_NAME);
DiscussionHistory history = new DiscussionHistory();
history.setMaxStanzas(200);
System.out.println(“JOINED EXISTING AS:”+connx.getUser());
muc.join(connx.getUser(),“password”,history,SmackConfiguration.getPacketReplyTi meout());
}
catch(XMPPException xmpe){xmpe.printStackTrace();}
return muc;
}
/code
Now if you notice, I join the muc as XMPPConnection.getUser() which is gforty@localhost.localdomain/Smack.
Now here is my leave method again:
//THIS METHOD WILL CAUSE A USER TO LEAVE A MULTI USER CHAT
public void leaveExistingMUC(Object conn, String room_name)throws XMPPException
{
MultiUserChat muc = null;
try
{
XMPPConnection connx = (XMPPConnection) conn;
muc = new MultiUserChat(connx,room_name);
System.out.println(“IS JOINED***********************”+muc.isJoined()); //THIS RETURNS FALSE
if(muc.isJoined()){
muc.leave();
}
else{
System.out.println(“Not joined”);}
}
catch(Exception e){e.printStackTrace();}
}
/code
So muc.isJoined() returns false.
So how is leave() called?
From SVN
429 public synchronized void leave() {
430 // If not joined already, do nothing.
431 if (!joined) {
432 return;
433 }
434 // We leave a room by sending a presence packet where the “to”
435 // field is in the form “roomName@service/nickname”
436 Presence leavePresence = new Presence(Presence.Type.UNAVAILABLE);
437 leavePresence.setTo(room + “/” + nickname);
438 connection.sendPacket(leavePresence);
439 // Reset participant information.
440 participantsMap = new HashMap();
441 nickname = null;
442 joined = false;
443 userHasLeft();
444 }
/code
Does the leavePresence.setTo method get its room and nickname from the connection object?
TIA!