From 660d81834803354140029ca27dd718fa588f157d Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Mon, 7 Dec 2009 13:40:57 +0200 Subject: Work on normal task EXT-3148 (Implement updating of the IM Well message counter) -- added new member in session stored count of unread messages from real participant and its updating -- added new method to IM Manager to caclculate total count of unread messages from real participants in all stored sessions -- added updating count of unread messages in IM Well counter --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'indra/newview/llchiclet.cpp') diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 5fad030e5b..8d4e16df8e 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -55,7 +55,7 @@ #include "lltransientfloatermgr.h" static LLDefaultChildRegistry::Register t1("chiclet_panel"); -static LLDefaultChildRegistry::Register t2_0("chiclet_im_well"); +static LLDefaultChildRegistry::Register t2_0("chiclet_im_well"); static LLDefaultChildRegistry::Register t2("chiclet_notification"); static LLDefaultChildRegistry::Register t3("chiclet_im_p2p"); static LLDefaultChildRegistry::Register t4("chiclet_im_group"); @@ -138,6 +138,26 @@ void LLSysWellChiclet::setToggleState(BOOL toggled) { mButton->setToggleState(toggled); } + +/************************************************************************/ +/* LLIMWellChiclet implementation */ +/************************************************************************/ +LLIMWellChiclet::LLIMWellChiclet(const Params& p) +: LLSysWellChiclet(p) +{ + LLIMModel::instance().addNewMsgCallback(boost::bind(&LLIMWellChiclet::messageCountChanged, this, _1)); + LLIMModel::instance().addNoUnreadMsgsCallback(boost::bind(&LLIMWellChiclet::messageCountChanged, this, _1)); +} + +void LLIMWellChiclet::messageCountChanged(const LLSD& session_data) +{ + S32 total_unread = LLIMMgr::instance().getNumberOfUnreadParticipantMessages(); + setCounter(total_unread); +} + +/************************************************************************/ +/* LLNotificationChiclet implementation */ +/************************************************************************/ LLNotificationChiclet::LLNotificationChiclet(const Params& p) : LLSysWellChiclet(p) { @@ -886,16 +906,7 @@ LLChicletPanel::~LLChicletPanel() void im_chiclet_callback(LLChicletPanel* panel, const LLSD& data){ LLUUID session_id = data["session_id"].asUUID(); - LLUUID from_id = data["from_id"].asUUID(); - const std::string from = data["from"].asString(); - S32 unread = data["num_unread"].asInteger(); - - // if new message came - if(unread != 0) - { - //we do not show balloon (indicator of new messages) for system messages and our own messages - if (from_id.isNull() || from_id == gAgentID || SYSTEM_FROM == from) return; - } + S32 unread = data["participant_unread"].asInteger(); LLIMFloater* im_floater = LLIMFloater::findInstance(session_id); if (im_floater && im_floater->getVisible()) -- cgit v1.2.3