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

--HG--
branch : product-engine
master
Eugene Mutavchi 2009-11-02 15:51:43 +02:00
parent 7691860f2e
commit 788b08f525
3 changed files with 34 additions and 23 deletions

View File

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

View File

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

View File

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