Skip to content
Snippets Groups Projects
Commit 788b08f5 authored by Eugene Mutavchi's avatar Eugene Mutavchi
Browse files

Fixed normal bug EXT-1877([BSI] Offline status not showing in IMs)

--HG--
branch : product-engine
parent 7691860f
No related branches found
No related tags found
No related merge requests found
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "llvoavatar.h" #include "llvoavatar.h"
#include "llimview.h" #include "llimview.h"
#include "llimpanel.h"
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// Local function declarations, constants, enums, and typedefs /// Local function declarations, constants, enums, and typedefs
...@@ -719,18 +718,8 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) ...@@ -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. // 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); LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id);
LLFloaterIMPanel *floater = gIMMgr->findFloaterBySession(session_id); std::string notify_msg = notification->getMessage();
if (floater) LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg);
{
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.
} }
mModifyMask |= LLFriendObserver::ONLINE; mModifyMask |= LLFriendObserver::ONLINE;
......
...@@ -105,7 +105,13 @@ void toast_callback(const LLSD& msg){ ...@@ -105,7 +105,13 @@ void toast_callback(const LLSD& msg){
{ {
return; return;
} }
// Skip toasting for system messages
if (msg["from_id"].asUUID() == LLUUID::null)
{
return;
}
LLSD args; LLSD args;
args["MESSAGE"] = msg["message"]; args["MESSAGE"] = msg["message"];
args["TIME"] = msg["time"]; args["TIME"] = msg["time"];
...@@ -403,6 +409,23 @@ bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, con ...@@ -403,6 +409,23 @@ bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, con
return false; 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, bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& from_id,
const std::string& utf8_text, bool log2file /* = true */) { const std::string& utf8_text, bool log2file /* = true */) {
LLIMSession* session = findIMSession(session_id); LLIMSession* session = findIMSession(session_id);
...@@ -2013,7 +2036,7 @@ void LLIMMgr::noteOfflineUsers( ...@@ -2013,7 +2036,7 @@ void LLIMMgr::noteOfflineUsers(
{ {
const LLRelationship* info = NULL; const LLRelationship* info = NULL;
LLAvatarTracker& at = LLAvatarTracker::instance(); LLAvatarTracker& at = LLAvatarTracker::instance();
LLIMModel* im_model = LLIMModel::getInstance(); LLIMModel& im_model = LLIMModel::instance();
for(S32 i = 0; i < count; ++i) for(S32 i = 0; i < count; ++i)
{ {
info = at.getBuddyInfo(ids.get(i)); info = at.getBuddyInfo(ids.get(i));
...@@ -2024,13 +2047,7 @@ void LLIMMgr::noteOfflineUsers( ...@@ -2024,13 +2047,7 @@ void LLIMMgr::noteOfflineUsers(
LLUIString offline = LLTrans::getString("offline_message"); LLUIString offline = LLTrans::getString("offline_message");
offline.setArg("[FIRST]", first); offline.setArg("[FIRST]", first);
offline.setArg("[LAST]", last); offline.setArg("[LAST]", last);
im_model.proccessOnlineOfflineNotification(session_id, offline);
if (floater)
{
floater->addHistoryLine(offline, LLUIColorTable::instance().getColor("SystemChatColor"));
}
im_model->addMessage(session_id, SYSTEM_FROM, LLUUID::null, offline);
} }
} }
} }
......
...@@ -136,7 +136,12 @@ class LLIMModel : public LLSingleton<LLIMModel> ...@@ -136,7 +136,12 @@ class LLIMModel : public LLSingleton<LLIMModel>
* It sends new message signal for each added message. * 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); 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. * Get a session's name.
* For a P2P chat - it's an avatar's name, * For a P2P chat - it's an avatar's name,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment