diff options
author | Eugene Mutavchi <emutavchi@productengine.com> | 2009-11-02 15:51:43 +0200 |
---|---|---|
committer | Eugene Mutavchi <emutavchi@productengine.com> | 2009-11-02 15:51:43 +0200 |
commit | 788b08f525ebfcc52ae1cf351d796594cf71f5c1 (patch) | |
tree | 7d0bbd23fff45fd4e52f6f6674a29324ebce1793 /indra | |
parent | 7691860f2e98b38d9304323f20648790552fc754 (diff) |
Fixed normal bug EXT-1877([BSI] Offline status not showing in IMs)
--HG--
branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llcallingcard.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llimview.cpp | 35 | ||||
-rw-r--r-- | indra/newview/llimview.h | 7 |
3 files changed, 34 insertions, 23 deletions
diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 7a81d0c4a1..e8812d87ee 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -62,7 +62,6 @@ #include "llviewerwindow.h" #include "llvoavatar.h" #include "llimview.h" -#include "llimpanel.h" ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs @@ -719,18 +718,8 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) // If there's an open IM session with this agent, send a notification there too. LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id); - LLFloaterIMPanel *floater = gIMMgr->findFloaterBySession(session_id); - if (floater) - { - std::string notifyMsg = notification->getMessage(); - if (!notifyMsg.empty()) - { - floater->addHistoryLine(notifyMsg,LLUIColorTable::instance().getColor("SystemChatColor")); - } - } - - //*TODO instead of adding IM message about online/offline status - //do something like graying avatar icon on messages from a user that went offline, and make it colored when online. + std::string notify_msg = notification->getMessage(); + LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg); } mModifyMask |= LLFriendObserver::ONLINE; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 49fc9d8055..41e2cff3b7 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -105,7 +105,13 @@ void toast_callback(const LLSD& msg){ { return; } - + + // Skip toasting for system messages + if (msg["from_id"].asUUID() == LLUUID::null) + { + return; + } + LLSD args; args["MESSAGE"] = msg["message"]; args["TIME"] = msg["time"]; @@ -403,6 +409,23 @@ bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, con return false; } +bool LLIMModel::proccessOnlineOfflineNotification( + const LLUUID& session_id, + const std::string& utf8_text) +{ + // Add message to old one floater + LLFloaterIMPanel *floater = gIMMgr->findFloaterBySession(session_id); + if ( floater ) + { + if ( !utf8_text.empty() ) + { + floater->addHistoryLine(utf8_text, LLUIColorTable::instance().getColor("SystemChatColor")); + } + } + // Add system message to history + return addMessage(session_id, SYSTEM_FROM, LLUUID::null, utf8_text); +} + bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text, bool log2file /* = true */) { LLIMSession* session = findIMSession(session_id); @@ -2013,7 +2036,7 @@ void LLIMMgr::noteOfflineUsers( { const LLRelationship* info = NULL; LLAvatarTracker& at = LLAvatarTracker::instance(); - LLIMModel* im_model = LLIMModel::getInstance(); + LLIMModel& im_model = LLIMModel::instance(); for(S32 i = 0; i < count; ++i) { info = at.getBuddyInfo(ids.get(i)); @@ -2024,13 +2047,7 @@ void LLIMMgr::noteOfflineUsers( LLUIString offline = LLTrans::getString("offline_message"); offline.setArg("[FIRST]", first); offline.setArg("[LAST]", last); - - if (floater) - { - floater->addHistoryLine(offline, LLUIColorTable::instance().getColor("SystemChatColor")); - } - - im_model->addMessage(session_id, SYSTEM_FROM, LLUUID::null, offline); + im_model.proccessOnlineOfflineNotification(session_id, offline); } } } diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index d0bd594df1..b3fe698ec7 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -136,7 +136,12 @@ public: * It sends new message signal for each added message. */ bool addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& other_participant_id, const std::string& utf8_text, bool log2file = true); - + + /** + * Add a system message to an IM Model + */ + bool proccessOnlineOfflineNotification(const LLUUID& session_id, const std::string& utf8_text); + /** * Get a session's name. * For a P2P chat - it's an avatar's name, |