From 677f51378e1afc338e92770e56905fe0ff184bc2 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 3 Feb 2010 19:11:44 +0200 Subject: Fixed normal bug EXT-2124 - [BSI] New notifications of group chat messages do not identify the destination group chat of message --HG-- branch : product-engine --- indra/newview/lltoastimpanel.cpp | 89 ++++++++++++++++------ indra/newview/lltoastimpanel.h | 3 + .../skins/default/xui/en/panel_instant_message.xml | 11 +++ 3 files changed, 78 insertions(+), 25 deletions(-) diff --git a/indra/newview/lltoastimpanel.cpp b/indra/newview/lltoastimpanel.cpp index a436dc0546..7ae2404203 100644 --- a/indra/newview/lltoastimpanel.cpp +++ b/indra/newview/lltoastimpanel.cpp @@ -37,6 +37,7 @@ #include "llfloaterreg.h" #include "llgroupactions.h" #include "llgroupiconctrl.h" +#include "llimview.h" #include "llnotifications.h" #include "llinstantmessage.h" #include "lltooltip.h" @@ -52,9 +53,9 @@ LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notif { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_instant_message.xml"); - LLIconCtrl* sys_msg_icon = getChild("sys_msg_icon"); mGroupIcon = getChild("group_icon"); mAvatarIcon = getChild("avatar_icon"); + mAdhocIcon = getChild("adhoc_icon"); mAvatarName = getChild("user_name"); mTime = getChild("time_box"); mMessage = getChild("message"); @@ -90,27 +91,7 @@ LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notif mAvatarID = p.avatar_id; mNotification = p.notification; - mAvatarIcon->setVisible(FALSE); - mGroupIcon->setVisible(FALSE); - sys_msg_icon->setVisible(FALSE); - - if(p.from == SYSTEM_FROM) - { - sys_msg_icon->setVisible(TRUE); - } - else - { - if(LLGroupActions::isInGroup(mSessionID)) - { - mGroupIcon->setVisible(TRUE); - mGroupIcon->setValue(p.session_id); - } - else - { - mAvatarIcon->setVisible(TRUE); - mAvatarIcon->setValue(p.avatar_id); - } - } + initIcon(); S32 maxLinesCount; std::istringstream ss( getString("message_max_lines_count") ); @@ -162,13 +143,27 @@ BOOL LLToastIMPanel::handleToolTip(S32 x, S32 y, MASK mask) void LLToastIMPanel::showInspector() { - if(LLGroupActions::isInGroup(mSessionID)) + LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionID); + if(!im_session) { - LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", mSessionID)); + llwarns << "Invalid IM session" << llendl; + return; } - else + + switch(im_session->mSessionType) { + case LLIMModel::LLIMSession::P2P_SESSION: LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mAvatarID)); + break; + case LLIMModel::LLIMSession::GROUP_SESSION: + LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", mSessionID)); + break; + case LLIMModel::LLIMSession::ADHOC_SESSION: + LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", im_session->mOtherParticipantID)); + break; + default: + llwarns << "Unknown IM session type" << llendl; + break; } } @@ -217,4 +212,48 @@ void LLToastIMPanel::spawnGroupIconToolTip() LLToolTipMgr::getInstance()->show(params); } +void LLToastIMPanel::initIcon() +{ + LLIconCtrl* sys_msg_icon = getChild("sys_msg_icon"); + + mAvatarIcon->setVisible(FALSE); + mGroupIcon->setVisible(FALSE); + sys_msg_icon->setVisible(FALSE); + mAdhocIcon->setVisible(FALSE); + + if(mAvatarName->getValue().asString() == SYSTEM_FROM) + { + sys_msg_icon->setVisible(TRUE); + } + else + { + LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionID); + if(!im_session) + { + llwarns << "Invalid IM session" << llendl; + return; + } + + switch(im_session->mSessionType) + { + case LLIMModel::LLIMSession::P2P_SESSION: + mAvatarIcon->setVisible(TRUE); + mAvatarIcon->setValue(mAvatarID); + break; + case LLIMModel::LLIMSession::GROUP_SESSION: + mGroupIcon->setVisible(TRUE); + mGroupIcon->setValue(mSessionID); + break; + case LLIMModel::LLIMSession::ADHOC_SESSION: + mAdhocIcon->setVisible(TRUE); + mAdhocIcon->setValue(im_session->mOtherParticipantID); + mAdhocIcon->setToolTip(im_session->mName); + break; + default: + llwarns << "Unknown IM session type" << llendl; + break; + } + } +} + // EOF diff --git a/indra/newview/lltoastimpanel.h b/indra/newview/lltoastimpanel.h index 444c0af144..cf4ad80637 100644 --- a/indra/newview/lltoastimpanel.h +++ b/indra/newview/lltoastimpanel.h @@ -66,6 +66,8 @@ private: void spawnNameToolTip(); void spawnGroupIconToolTip(); + void initIcon(); + static const S32 DEFAULT_MESSAGE_MAX_LINE_COUNT; LLNotificationPtr mNotification; @@ -73,6 +75,7 @@ private: LLUUID mAvatarID; LLAvatarIconCtrl* mAvatarIcon; LLGroupIconCtrl* mGroupIcon; + LLAvatarIconCtrl* mAdhocIcon; LLTextBox* mAvatarName; LLTextBox* mTime; LLTextBox* mMessage; diff --git a/indra/newview/skins/default/xui/en/panel_instant_message.xml b/indra/newview/skins/default/xui/en/panel_instant_message.xml index 5a1bc32db0..a0ad38cf76 100644 --- a/indra/newview/skins/default/xui/en/panel_instant_message.xml +++ b/indra/newview/skins/default/xui/en/panel_instant_message.xml @@ -45,6 +45,17 @@ name="group_icon" top="3" width="18" /> +