Skip to content

Commit

Permalink
Try to destroy a chat room when leaving it
Browse files Browse the repository at this point in the history
  • Loading branch information
andysprout committed Jul 27, 2011
1 parent b95c320 commit 9da9eda
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/com/cleartext/esm/models/ChatRoomModel.as
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,13 @@ package com.cleartext.esm.models

chatRoom.participants.removeAll();
}

public function destroy(chatRoom:ChatRoom):void
{
if(!chatRoom.status.isOffline())
xmpp.destroyChatRoom(chatRoom.jid, chatRoom.ourNickname);

chatRoom.participants.removeAll();
}
}
}
9 changes: 9 additions & 0 deletions src/com/cleartext/esm/models/XMPPModel.as
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,15 @@ package com.cleartext.esm.models
xmpp.send('<presence type="unavailable" to="' + roomJid + "/" + nickname +'" />');
}

//-------------------------------
// DESTROY CHAT ROOM
//-------------------------------

public function destroyChatRoom(roomJid:String, nickname:String):void
{
sendIq(roomJid, IQTypes.SET, <query xmlns={MUC_OWNER_NS}><destroy/></query> );
}

//-------------------------------
// CREATE DEFAULT CHAT ROOM
//-------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/com/cleartext/esm/views/popup/RemoveBuddyWindow.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
{
if(contact is ChatRoom)
{
chatRooms.leave(contact as ChatRoom);
chatRooms.destroy(contact as ChatRoom);
}
buddies.removeBuddy(contact);
chats.removeChat(contact);
Expand Down

0 comments on commit 9da9eda

Please sign in to comment.