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
master
Dmitry Zaporozhan 2010-02-03 19:11:44 +02:00
parent 7b365fd296
commit 677f51378e
3 changed files with 78 additions and 25 deletions

View File

@ -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<LLIconCtrl>("sys_msg_icon");
mGroupIcon = getChild<LLGroupIconCtrl>("group_icon");
mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon");
mAdhocIcon = getChild<LLAvatarIconCtrl>("adhoc_icon");
mAvatarName = getChild<LLTextBox>("user_name");
mTime = getChild<LLTextBox>("time_box");
mMessage = getChild<LLTextBox>("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<LLIconCtrl>("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

View File

@ -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;

View File

@ -45,6 +45,17 @@
name="group_icon"
top="3"
width="18" />
<avatar_icon
color="Green"
follows="right"
height="18"
image_name="Generic_Person"
layout="topleft"
left="3"
mouse_opaque="false"
name="adhoc_icon"
top="3"
width="18" />
<!--<icon
follows="right"
height="20"