diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index ee4a9df15fa9a377dd6804709e88fc183aa04927..0844cca766283a6f3c30bf3b4b8f294d70a30cf6 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -189,6 +189,19 @@ void LLAvatarActions::startIM(const LLUUID& id) make_ui_sound("UISndStartIM"); } +// static +void LLAvatarActions::endIM(const LLUUID& id) +{ + if (id.isNull()) + return; + + LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); + if (session_id != LLUUID::null) + { + gIMMgr->leaveSession(session_id); + } +} + // static void LLAvatarActions::startCall(const LLUUID& id) { diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 66ea6880dbf22267c06beeaa6665ce9491401383..d9dab95a77016e540f61bdd45f7a4ae7a557d2db 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -73,6 +73,11 @@ class LLAvatarActions */ static void startIM(const LLUUID& id); + /** + * End instant messaging session. + */ + static void endIM(const LLUUID& id); + /** * Start an avatar-to-avatar voice call with another user */ diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 4078fac4ecbadad10e198e505437ebebd2aecea1..5375c3ea493c20773320b188e591fab9a8545732 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -482,6 +482,10 @@ void LLIMP2PChiclet::onMenuItemClicked(const LLSD& user_data) { LLAvatarActions::requestFriendshipDialog(other_participant_id); } + else if("close" == level) + { + LLAvatarActions::endIM(other_participant_id); + } } ////////////////////////////////////////////////////////////////////////// @@ -776,12 +780,16 @@ void LLIMGroupChiclet::onMenuItemClicked(const LLSD& user_data) if("group chat" == level) { - LLGroupActions::startChat(group_id); + LLGroupActions::startIM(group_id); } else if("info" == level) { LLGroupActions::show(group_id); } + else if("close" == level) + { + LLGroupActions::endIM(group_id); + } } diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index 45af515a869a73d127aa349f5db20a6978c04d7b..7cb925bc0b09a8d795cc9761cb3f41bc812e0421 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -327,7 +327,7 @@ void LLPanelGroups::startIM() if (group_list && (group_id = group_list->getCurrentID()).notNull()) { - LLGroupActions::startChat(group_id); + LLGroupActions::startIM(group_id); } } diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index e60bde9fd8911afb72cccfee1393849f09733d6b..f4e1951c7b2f9869bd504234702a55f82db61165 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -272,7 +272,7 @@ void LLGroupActions::closeGroup(const LLUUID& group_id) // static -void LLGroupActions::startChat(const LLUUID& group_id) +void LLGroupActions::startIM(const LLUUID& group_id) { if (group_id.isNull()) return; @@ -298,6 +298,19 @@ void LLGroupActions::startChat(const LLUUID& group_id) } } +// static +void LLGroupActions::endIM(const LLUUID& group_id) +{ + if (group_id.isNull()) + return; + + LLUUID session_id = gIMMgr->computeSessionID(IM_SESSION_GROUP_START, group_id); + if (session_id != LLUUID::null) + { + gIMMgr->leaveSession(session_id); + } +} + // static bool LLGroupActions::isInGroup(const LLUUID& group_id) { diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h index 74c84d1561749864997d59231dd9f6f3b581abf3..9750b3e3cb7af2a54c1ada7c479fd29eb8a037ea 100644 --- a/indra/newview/llgroupactions.h +++ b/indra/newview/llgroupactions.h @@ -88,7 +88,12 @@ class LLGroupActions /** * Start group instant messaging session. */ - static void startChat(const LLUUID& group_id); + static void startIM(const LLUUID& group_id); + + /** + * End group instant messaging session. + */ + static void endIM(const LLUUID& group_id); /// Returns if the current user is a member of the group static bool isInGroup(const LLUUID& group_id); diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 709525d4e268310b8e711ab8d64af5a3e96b0b7b..4dc88725573273b3e7655fa4843f2f04c0cfd916 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -1017,7 +1017,7 @@ void LLPanelPeople::onChatButtonClicked() { LLUUID group_id = getCurrentItemID(); if (group_id.notNull()) - LLGroupActions::startChat(group_id); + LLGroupActions::startIM(group_id); } void LLPanelPeople::onImButtonClicked() diff --git a/indra/newview/skins/default/xui/en/menu_imchiclet_group.xml b/indra/newview/skins/default/xui/en/menu_imchiclet_group.xml index 542e319792bfc6343058eab790aa7f2029138ae0..dfe4605b7acc0d10cb361befa4faf3e7cf6ecd3c 100644 --- a/indra/newview/skins/default/xui/en/menu_imchiclet_group.xml +++ b/indra/newview/skins/default/xui/en/menu_imchiclet_group.xml @@ -24,4 +24,12 @@ function="IMChicletMenu.Action" parameter="info" /> </menu_item_call> + <menu_item_call + label="Close Session" + layout="topleft" + name="Close Session"> + <menu_item_call.on_click + function="IMChicletMenu.Action" + parameter="close" /> + </menu_item_call> </menu> diff --git a/indra/newview/skins/default/xui/en/menu_imchiclet_p2p.xml b/indra/newview/skins/default/xui/en/menu_imchiclet_p2p.xml index c205868429e3719e6db7c829a40d499c20805857..4cabcb90317e30ca563b4ae5f97f3ea7aa19777f 100644 --- a/indra/newview/skins/default/xui/en/menu_imchiclet_p2p.xml +++ b/indra/newview/skins/default/xui/en/menu_imchiclet_p2p.xml @@ -32,4 +32,12 @@ function="IMChicletMenu.Action" parameter="add" /> </menu_item_call> + <menu_item_call + label="Close Session" + layout="topleft" + name="Close Session"> + <menu_item_call.on_click + function="IMChicletMenu.Action" + parameter="close" /> + </menu_item_call> </menu>