XMPPFramework icon indicating copy to clipboard operation
XMPPFramework copied to clipboard

XMPPRoom's delegate method xmppRoomDidDestroy can't be called

Open uniquecolin opened this issue 9 years ago • 1 comments

Hi, all. When I call XMPPRoom's destroyRoom method, the delegate method -(void)xmppRoomDidDestroy:(XMPPRoom*)sender can't be called. After I digging into the source code of XMPPRoom class and XEP-0045 specification, I found the problem: in the process of destroying a chat room, service broadcast self unavailable presence to each occupant, and in the XMPPRoom's implementation: - (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence { // ...

if (isMyPresence)
{
    if (isAvailable)
    {
        // ...
    }
    else if (isUnavailable && !isNicknameChange)
    {
        state = kXMPPRoomStateNone;
        [responseTracker removeAllIDs]; // response of destroying room IQ comes after
                   // presence broadcast, but tracker is removed

        [xmppRoomStorage handleDidLeaveRoom:self];
        [multicastDelegate xmppRoomDidLeave:self];
    }
}
else
{
    // ...
}

}

What's the solution? Add a state kXMPPRoomStateDestroying, and check it whether we should remove all response trackers, is it ok?

uniquecolin avatar Sep 03 '15 07:09 uniquecolin

same question,did you solved it?

huoda1237 avatar Feb 02 '24 03:02 huoda1237