From a4000c3744e42fcbb638e742f3b63fa31a0dee15 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Fri, 8 May 2009 07:43:08 +0000 Subject: merge trunk@116587 skinning-7@119389 -> viewer-2.0.0-skinning-7 --- indra/newview/llimview.cpp | 347 +++++++++++++++++++++++++++++---------------- 1 file changed, 227 insertions(+), 120 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index a90ea39265..26ce5c5ac4 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -34,6 +34,7 @@ #include "llimview.h" +#include "llfloaterreg.h" #include "llfontgl.h" #include "llrect.h" #include "llerror.h" @@ -44,12 +45,12 @@ #include "lluictrlfactory.h" #include "llagent.h" +#include "llavatariconctrl.h" #include "llcallingcard.h" #include "llchat.h" #include "llresmgr.h" #include "llfloaterchat.h" #include "llfloaterchatterbox.h" -#include "llfloaternewim.h" #include "llhttpnode.h" #include "llimpanel.h" #include "llresizebar.h" @@ -67,6 +68,8 @@ #include "llviewerwindow.h" #include "llnotify.h" #include "llviewerregion.h" +#include "llviewertexteditor.h" +#include "lltrans.h" #include "llfirstuse.h" @@ -145,11 +148,11 @@ public: floaterp->requestAutoConnect(); LLFloaterIMPanel::onClickStartCall(floaterp); // always open IM window when connecting to voice - LLFloaterChatterBox::showInstance(TRUE); + LLFloaterReg::showInstance("communicate", LLSD(), TRUE); } else if ( mInvitiationType == LLIMMgr::INVITATION_TYPE_IMMEDIATE ) { - LLFloaterChatterBox::showInstance(TRUE); + LLFloaterReg::showInstance("communicate", LLSD(), TRUE); } } @@ -234,7 +237,8 @@ LLUUID LLIMMgr::computeSessionID( // LLFloaterIM //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LLFloaterIM::LLFloaterIM() +LLFloaterIM::LLFloaterIM() + : LLMultiFloater() { // autoresize=false is necessary to avoid resizing of the IM window whenever // a session is opened or closed (it would otherwise resize the window to match @@ -324,6 +328,168 @@ BOOL LLFloaterIM::postBuild() return TRUE; } +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLIncomingCallDialog +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LLIncomingCallDialog::LLIncomingCallDialog(const LLSD& payload) : + LLModalDialog(LLStringUtil::null, 240, 200), + mPayload(payload) +{ + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_incoming_call.xml"); +} + +BOOL LLIncomingCallDialog::postBuild() +{ + LLSD caller_id = mPayload["caller_id"]; + EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger(); + + std::string call_type = getString("VoiceInviteP2P"); + std::string caller_name = mPayload["caller_name"].asString() + " "; + setTitle(caller_name + call_type); + + // If it is not a P2P invite, then it's an AdHoc invite + if ( type != IM_SESSION_P2P_INVITE ) + { + call_type = getString("VoiceInviteAdHoc"); + } + + LLViewerTextEditor* text = getChild("caller name"); + text->setEmbeddedText(caller_name + call_type); + LLAvatarIconCtrl* icon = getChild("avatar_icon"); + icon->setValue(caller_id); + + childSetAction("Accept", onAccept, this); + childSetAction("Reject", onReject, this); + childSetAction("Start IM", onStartIM, this); + childSetFocus("Accept"); + + return TRUE; +} + +//static +void LLIncomingCallDialog::onAccept(void* user_data) +{ + LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data; + self->processCallResponse(0); + self->closeFloater(); +} + +//static +void LLIncomingCallDialog::onReject(void* user_data) +{ + LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data; + self->processCallResponse(1); + self->closeFloater(); +} + +//static +void LLIncomingCallDialog::onStartIM(void* user_data) +{ + LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data; + self->processCallResponse(2); + self->closeFloater(); +} + +void LLIncomingCallDialog::processCallResponse(S32 response) +{ + LLUUID session_id = mPayload["session_id"].asUUID(); + EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger(); + LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)mPayload["inv_type"].asInteger(); + bool voice = true; + switch(response) + { + case 2: // start IM: just don't start the voice chat + { + voice = false; + /* FALLTHROUGH */ + } + case 0: // accept + { + if (type == IM_SESSION_P2P_INVITE) + { + // create a normal IM session + session_id = gIMMgr->addP2PSession( + mPayload["session_name"].asString(), + mPayload["caller_id"].asUUID(), + mPayload["session_handle"].asString()); + + if (voice) + { + LLFloaterIMPanel* im_floater = + gIMMgr->findFloaterBySession( + session_id); + + if (im_floater) + { + im_floater->requestAutoConnect(); + LLFloaterIMPanel::onClickStartCall(im_floater); + } + } + + // always open IM window when connecting to voice + LLFloaterReg::showInstance("communicate", session_id); + + gIMMgr->clearPendingAgentListUpdates(session_id); + gIMMgr->clearPendingInvitation(session_id); + } + else + { + gIMMgr->addSession( + mPayload["session_name"].asString(), + type, + session_id); + + std::string url = gAgent.getRegion()->getCapability( + "ChatSessionRequest"); + + if (voice) + { + LLSD data; + data["method"] = "accept invitation"; + data["session-id"] = session_id; + LLHTTPClient::post( + url, + data, + new LLViewerChatterBoxInvitationAcceptResponder( + session_id, + inv_type)); + } + } + if (voice) + { + break; + } + } + case 1: // decline + { + if (type == IM_SESSION_P2P_INVITE) + { + if(gVoiceClient) + { + std::string s = mPayload["session_handle"].asString(); + gVoiceClient->declineInvite(s); + } + } + else + { + std::string url = gAgent.getRegion()->getCapability( + "ChatSessionRequest"); + + LLSD data; + data["method"] = "decline invitation"; + data["session-id"] = session_id; + LLHTTPClient::post( + url, + data, + NULL); + } + } + + gIMMgr->clearPendingAgentListUpdates(session_id); + gIMMgr->clearPendingInvitation(session_id); + } +} + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLIMViewFriendObserver // @@ -375,7 +541,7 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response) im_floater->requestAutoConnect(); LLFloaterIMPanel::onClickStartCall(im_floater); // always open IM window when connecting to voice - LLFloaterChatterBox::showInstance(session_id); + LLFloaterReg::showInstance("communicate", session_id, TRUE); } gIMMgr->clearPendingAgentListUpdates(session_id); @@ -467,54 +633,6 @@ EInstantMessage LLIMMgr::defaultIMTypeForAgent(const LLUUID& agent_id) return type; } -// static -//void LLIMMgr::onPinButton(void*) -//{ -// BOOL state = gSavedSettings.getBOOL( "PinTalkViewOpen" ); -// gSavedSettings.setBOOL( "PinTalkViewOpen", !state ); -//} - -// static -void LLIMMgr::toggle(void*) -{ - static BOOL return_to_mouselook = FALSE; - - // Hide the button and show the floater or vice versa. - llassert( gIMMgr ); - BOOL old_state = gIMMgr->getFloaterOpen(); - - // If we're in mouselook and we triggered the Talk View, we want to talk. - if( gAgent.cameraMouselook() && old_state ) - { - return_to_mouselook = TRUE; - gAgent.changeCameraToDefault(); - return; - } - - BOOL new_state = !old_state; - - if (new_state) - { - // ...making visible - if ( gAgent.cameraMouselook() ) - { - return_to_mouselook = TRUE; - gAgent.changeCameraToDefault(); - } - } - else - { - // ...hiding - if ( gAgent.cameraThirdPerson() && return_to_mouselook ) - { - gAgent.changeCameraToMouselook(); - } - return_to_mouselook = FALSE; - } - - gIMMgr->setFloaterOpen( new_state ); -} - // // Member Functions // @@ -614,10 +732,10 @@ void LLIMMgr::addMessage( { // *TODO:translate (low priority, god ability) std::ostringstream bonus_info; - bonus_info << "*** parent estate: " + bonus_info << LLTrans::getString("***")+ " "+ LLTrans::getString("IMParentEstate") + ":" + " " << parent_estate_id - << ((parent_estate_id == 1) ? ", mainland" : "") - << ((parent_estate_id == 5) ? ", teen" : ""); + << ((parent_estate_id == 1) ? "," + LLTrans::getString("IMMainland") : "") + << ((parent_estate_id == 5) ? "," + LLTrans::getString ("IMTeen") : ""); // once we have web-services (or something) which returns // information about a region id, we can print this out @@ -625,7 +743,7 @@ void LLIMMgr::addMessage( //<< "*** region_id: " << region_id << std::endl //<< "*** position: " << position << std::endl; - floater->addHistoryLine(bonus_info.str(), gSavedSettings.getColor4("SystemChatColor")); + floater->addHistoryLine(bonus_info.str(), gSavedSkinSettings.getColor4("SystemChatColor")); } make_ui_sound("UISndNewIncomingIMSession"); @@ -634,8 +752,8 @@ void LLIMMgr::addMessage( // now add message to floater bool is_from_system = target_id.isNull() || (from == SYSTEM_FROM); const LLColor4& color = ( is_from_system ? - gSavedSettings.getColor4("SystemChatColor") : - gSavedSettings.getColor("IMChatColor")); + gSavedSkinSettings.getColor4("SystemChatColor") : + gSavedSkinSettings.getColor("IMChatColor")); if ( !link_name ) { floater->addHistoryLine(msg,color); // No name to prepend, so just add the message normally @@ -645,10 +763,10 @@ void LLIMMgr::addMessage( floater->addHistoryLine(msg, color, true, other_participant_id, from); // Insert linked name to front of message } - LLFloaterChatterBox* chat_floater = LLFloaterChatterBox::getInstance(LLSD()); - - if( !chat_floater->getVisible() && !floater->getVisible()) + if( !LLFloaterReg::instanceVisible("communicate") && !floater->getVisible()) { + LLFloaterChatterBox* chat_floater = LLFloaterChatterBox::getInstance(); + //if the IM window is not open and the floater is not visible (i.e. not torn off) LLFloater* previouslyActiveFloater = chat_floater->getActiveFloater(); @@ -675,14 +793,12 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess // null session id means near me (chat history) if (session_id.isNull()) { - LLFloaterChat* floaterp = LLFloaterChat::getInstance(); - - message = floaterp->getString(message_name); + message = LLTrans::getString(message_name); message.setArgs(args); LLChat chat(message); chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLFloaterChat::getInstance()->addChatHistory(chat); + LLFloaterChat::addChatHistory(chat); } else // going to IM session { @@ -699,7 +815,7 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess void LLIMMgr::notifyNewIM() { - if(!gIMMgr->getFloaterOpen()) + if(!LLFloaterReg::instanceVisible("communicate")) { mIMReceived = TRUE; } @@ -767,18 +883,17 @@ LLUUID LLIMMgr::addSession( TRUE); noteOfflineUsers(floater, ids); - LLFloaterChatterBox::showInstance(session_id); + LLFloaterReg::showInstance("communicate", session_id); // Only warn for regular IMs - not group IMs if( dialog == IM_NOTHING_SPECIAL ) { noteMutedUsers(floater, ids); } - LLFloaterChatterBox::getInstance(LLSD())->showFloater(floater); } else { - floater->open(); + floater->openFloater(); } //mTabContainer->selectTabPanel(panel); floater->setInputFocus(TRUE); @@ -818,7 +933,7 @@ LLUUID LLIMMgr::addSession( if ( !floater ) return LLUUID::null; noteOfflineUsers(floater, ids); - LLFloaterChatterBox::showInstance(session_id); + LLFloaterReg::showInstance("communicate", session_id); // Only warn for regular IMs - not group IMs if( dialog == IM_NOTHING_SPECIAL ) @@ -828,7 +943,7 @@ LLUUID LLIMMgr::addSession( } else { - floater->open(); + floater->openFloater(); } //mTabContainer->selectTabPanel(panel); floater->setInputFocus(TRUE); @@ -843,7 +958,7 @@ void LLIMMgr::removeSession(const LLUUID& session_id) if(floater) { mFloaters.erase(floater->getHandle()); - LLFloaterChatterBox::getInstance(LLSD())->removeFloater(floater); + LLFloaterChatterBox::getInstance()->removeFloater(floater); //mTabContainer->removeTabPanel(floater); clearPendingInvitation(session_id); @@ -932,65 +1047,60 @@ void LLIMMgr::inviteToSession( { if (caller_name.empty()) { - gCacheName->getName(caller_id, onInviteNameLookup, new LLSD(payload)); + gCacheName->get(caller_id, FALSE, boost::bind(&LLIMMgr::onInviteNameLookup, payload, _1, _2, _3, _4)); } else { - LLSD args; - args["NAME"] = caller_name; - args["GROUP"] = session_name; - - LLNotifications::instance().add(notify_box_type, - args, - payload, - &inviteUserResponse); - + if (notify_box_type == "VoiceInviteP2P" || notify_box_type == "VoiceInviteAdHoc") + { + LLIncomingCallDialog *dialog = new LLIncomingCallDialog(payload); + dialog->startModal(); + } + else + { + LLSD args; + args["NAME"] = caller_name; + args["GROUP"] = session_name; + + LLNotifications::instance().add(notify_box_type, + args, + payload, + &inviteUserResponse); + } } mPendingInvitations[session_id.asString()] = LLSD(); } } -//static -void LLIMMgr::onInviteNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* userdata) +void LLIMMgr::onInviteNameLookup(LLSD payload, const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group) { - LLSD payload = *(LLSD*)userdata; - delete (LLSD*)userdata; - payload["caller_name"] = first + " " + last; payload["session_name"] = payload["caller_name"].asString(); - LLSD args; - args["NAME"] = payload["caller_name"].asString(); - - LLNotifications::instance().add( - payload["notify_box_type"].asString(), - args, - payload, - &inviteUserResponse); -} - -void LLIMMgr::refresh() -{ -} + std::string notify_box_type = payload["notify_box_type"].asString(); -void LLIMMgr::setFloaterOpen(BOOL set_open) -{ - if (set_open) + if (notify_box_type == "VoiceInviteP2P" || notify_box_type == "VoiceInviteAdHoc") { - LLFloaterChatterBox::showInstance(); + LLIncomingCallDialog *dialog = new LLIncomingCallDialog(payload); + dialog->startModal(); } else { - LLFloaterChatterBox::hideInstance(); + LLSD args; + args["NAME"] = payload["caller_name"].asString(); + + LLNotifications::instance().add( + payload["notify_box_type"].asString(), + args, + payload, + &inviteUserResponse); } } - -BOOL LLIMMgr::getFloaterOpen() +void LLIMMgr::refresh() { - return LLFloaterChatterBox::instanceVisible(LLSD()); } - + void LLIMMgr::disconnectAllSessions() { LLFloaterIMPanel* floater = NULL; @@ -1007,7 +1117,7 @@ void LLIMMgr::disconnectAllSessions() if (floater) { floater->setEnabled(FALSE); - floater->close(TRUE); + floater->closeFloater(TRUE); } } } @@ -1146,12 +1256,14 @@ LLFloaterIMPanel* LLIMMgr::createFloater( llinfos << "LLIMMgr::createFloater: from " << other_participant_id << " in session " << session_id << llendl; + std::vector ids; LLFloaterIMPanel* floater = new LLFloaterIMPanel(session_label, session_id, other_participant_id, + ids, dialog); LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; - LLFloaterChatterBox::getInstance(LLSD())->addFloater(floater, FALSE, i_pt); + LLFloaterChatterBox::getInstance()->addFloater(floater, FALSE, i_pt); mFloaters.insert(floater->getHandle()); return floater; } @@ -1177,7 +1289,7 @@ LLFloaterIMPanel* LLIMMgr::createFloater( ids, dialog); LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; - LLFloaterChatterBox::getInstance(LLSD())->addFloater(floater, FALSE, i_pt); + LLFloaterChatterBox::getInstance()->addFloater(floater, FALSE, i_pt); mFloaters.insert(floater->getHandle()); return floater; } @@ -1189,7 +1301,7 @@ void LLIMMgr::noteOfflineUsers( S32 count = ids.count(); if(count == 0) { - floater->addHistoryLine(sOnlyUserMessage, gSavedSettings.getColor4("SystemChatColor")); + floater->addHistoryLine(sOnlyUserMessage, gSavedSkinSettings.getColor4("SystemChatColor")); } else { @@ -1205,7 +1317,7 @@ void LLIMMgr::noteOfflineUsers( LLUIString offline = sOfflineMessage; offline.setArg("[FIRST]", first); offline.setArg("[LAST]", last); - floater->addHistoryLine(offline, gSavedSettings.getColor4("SystemChatColor")); + floater->addHistoryLine(offline, gSavedSkinSettings.getColor4("SystemChatColor")); } } } @@ -1267,11 +1379,6 @@ void LLIMMgr::updateFloaterSessionID( } } -LLFloaterChatterBox* LLIMMgr::getFloater() -{ - return LLFloaterChatterBox::getInstance(LLSD()); -} - class LLViewerChatterBoxSessionStartReply : public LLHTTPNode { public: -- cgit v1.2.3 From 01d390825a5d9ba37715b80cd0aa7aede022dcec Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Fri, 22 May 2009 23:27:16 +0000 Subject: DEV-27646 dll linkage for login module. Ok, finally got this to a point where it doesn't break the build and I can check in. llcommon can be built as a shared library (disabled but can be enabled with cmake cache var LLCOMMON_LINK_SHARED. reviewed by Mani on tuesday (I still need to get his suggested changes re-reviewed) --- indra/newview/llimview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 26ce5c5ac4..9e3bc76c9c 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -40,7 +40,7 @@ #include "llerror.h" #include "llbutton.h" #include "llhttpclient.h" -#include "llsdutil.h" +#include "llsdutil_math.h" #include "llstring.h" #include "lluictrlfactory.h" -- cgit v1.2.3 From b544e125a4015550faf274904ac6d049e5fe5760 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Mon, 26 Oct 2009 08:16:20 +0200 Subject: IM minor refactoring: removed unused LLIMMgr::isIMSessionOpen(...) - duplicate of LLIMMgr::hasSession(...) --HG-- branch : product-engine --- indra/newview/llimview.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index b631c991ae..8d72ffdfcc 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1458,15 +1458,6 @@ BOOL LLIMMgr::getIMReceived() const return mIMReceived; } -// This method returns TRUE if the local viewer has a session -// currently open keyed to the uuid. -BOOL LLIMMgr::isIMSessionOpen(const LLUUID& uuid) -{ - LLFloaterIMPanel* floater = findFloaterBySession(uuid); - if(floater) return TRUE; - return FALSE; -} - LLUUID LLIMMgr::addP2PSession(const std::string& name, const LLUUID& other_participant_id, const std::string& voice_session_handle, -- cgit v1.2.3 From e018754f7e94be57dec9f7f8c341caa39643c277 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Mon, 26 Oct 2009 13:05:08 +0200 Subject: IM: removed unused & empty methods and classes, added TODO marks --HG-- branch : product-engine --- indra/newview/llimview.cpp | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 8d72ffdfcc..fa7e1170be 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1114,29 +1114,6 @@ void LLIncomingCallDialog::processCallResponse(S32 response) } } -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLIMViewFriendObserver -// -// Bridge to suport knowing when the inventory has changed. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLIMViewFriendObserver : public LLFriendObserver -{ -public: - LLIMViewFriendObserver(LLIMMgr* tv) : mTV(tv) {} - virtual ~LLIMViewFriendObserver() {} - virtual void changed(U32 mask) - { - if(mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE)) - { - mTV->refresh(); - } - } -protected: - LLIMMgr* mTV; -}; - - bool inviteUserResponse(const LLSD& notification, const LLSD& response) { const LLSD& payload = notification["payload"]; @@ -1237,7 +1214,6 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response) // LLIMMgr::LLIMMgr() : - mFriendObserver(NULL), mIMReceived(FALSE) { static bool registered_dialog = false; @@ -1246,21 +1222,11 @@ LLIMMgr::LLIMMgr() : LLFloaterReg::add("incoming_call", "floater_incoming_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); registered_dialog = true; } - - mFriendObserver = new LLIMViewFriendObserver(this); - LLAvatarTracker::instance().addObserver(mFriendObserver); mPendingInvitations = LLSD::emptyMap(); mPendingAgentListUpdates = LLSD::emptyMap(); } -LLIMMgr::~LLIMMgr() -{ - LLAvatarTracker::instance().removeObserver(mFriendObserver); - delete mFriendObserver; - // Children all cleaned up by default view destructor. -} - // Add a message to a session. void LLIMMgr::addMessage( const LLUUID& session_id, @@ -1714,10 +1680,6 @@ void LLIMMgr::onInviteNameLookup(LLSD payload, const LLUUID& id, const std::stri } } -void LLIMMgr::refresh() -{ -} - void LLIMMgr::disconnectAllSessions() { LLFloaterIMPanel* floater = NULL; -- cgit v1.2.3 From d81b8884109cbeacf211282b0a08aa3aea425294 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Mon, 26 Oct 2009 16:41:47 +0200 Subject: IM: fixed remove session logic, got rid of "being session removed" field --HG-- branch : product-engine --- indra/newview/llimview.cpp | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index fa7e1170be..593f3a1e82 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1405,10 +1405,7 @@ S32 LLIMMgr::getNumberOfUnreadIM() S32 num = 0; for(it = LLIMModel::sSessionsMap.begin(); it != LLIMModel::sSessionsMap.end(); ++it) { - if((*it).first != mBeingRemovedSessionID) - { - num += (*it).second->mNumUnread; - } + num += (*it).second->mNumUnread; } return num; @@ -1517,41 +1514,25 @@ bool LLIMMgr::leaveSession(const LLUUID& session_id) return true; } -// This removes the panel referenced by the uuid, and then restores -// internal consistency. The internal pointer is not deleted? Did you mean -// a pointer to the corresponding LLIMSession? Session data is cleared now. -// Put a copy of UUID to avoid problem when passed reference becames invalid -// if it has been come from the object removed in observer. -void LLIMMgr::removeSession(LLUUID session_id) +// Removes data associated with a particular session specified by session_id +void LLIMMgr::removeSession(const LLUUID& session_id) { - if (mBeingRemovedSessionID == session_id) - { - return; - } + llassert_always(hasSession(session_id)); + //*TODO remove this floater thing when Communicate Floater is being deleted (IB) LLFloaterIMPanel* floater = findFloaterBySession(session_id); if(floater) { mFloaters.erase(floater->getHandle()); LLFloaterChatterBox::getInstance()->removeFloater(floater); - //mTabContainer->removeTabPanel(floater); - - clearPendingInvitation(session_id); - clearPendingAgentListUpdates(session_id); } - // for some purposes storing ID of a sessios that is being removed - mBeingRemovedSessionID = session_id; - notifyObserverSessionRemoved(session_id); + clearPendingInvitation(session_id); + clearPendingAgentListUpdates(session_id); - //if we don't clear session data on removing the session - //we can't use LLBottomTray as observer of session creation/delettion and - //creating chiclets only on session created even, we need to handle chiclets creation - //the same way as LLFloaterIMPanels were managed. LLIMModel::getInstance()->clearSession(session_id); - // now this session is completely removed - mBeingRemovedSessionID.setNull(); + notifyObserverSessionRemoved(session_id); } void LLIMMgr::inviteToSession( -- cgit v1.2.3 From f22f829b8642d59cb5953eb33f5297a1da90fadd Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Mon, 26 Oct 2009 17:14:32 +0200 Subject: Fixed normal bugs EXT-1628 ([BSI] - New IM system isn't sending typing notifications anymore) and EXT-1629 ([BSI] - add hint in IM window when Resident is typing) --HG-- branch : product-engine --- indra/newview/llimview.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index fa7e1170be..f8d794e967 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1991,6 +1991,12 @@ void LLIMMgr::processIMTypingCore(const LLIMInfo* im_info, BOOL typing) { floater->processIMTyping(im_info, typing); } + + LLIMFloater* im_floater = LLIMFloater::findInstance(session_id); + if ( im_floater ) + { + im_floater->processIMTyping(im_info, typing); + } } class LLViewerChatterBoxSessionStartReply : public LLHTTPNode -- cgit v1.2.3 From e931d2d6f1a7d981bebf07b1d089fa4751096830 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Mon, 26 Oct 2009 17:33:28 +0200 Subject: IM refac.: replaced passing copies by passing references, moved some IMModel private, added documentation --HG-- branch : product-engine --- indra/newview/llimview.cpp | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 593f3a1e82..439f0b3d1e 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -272,7 +272,8 @@ void LLIMModel::testMessages() } -bool LLIMModel::newSession(LLUUID session_id, std::string name, EInstantMessage type, LLUUID other_participant_id, const std::vector& ids) +bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, + const LLUUID& other_participant_id, const std::vector& ids) { if (is_in_map(sSessionsMap, session_id)) { @@ -289,7 +290,7 @@ bool LLIMModel::newSession(LLUUID session_id, std::string name, EInstantMessage } -bool LLIMModel::clearSession(LLUUID session_id) +bool LLIMModel::clearSession(const LLUUID& session_id) { if (sSessionsMap.find(session_id) == sSessionsMap.end()) return false; delete (sSessionsMap[session_id]); @@ -297,16 +298,13 @@ bool LLIMModel::clearSession(LLUUID session_id) return true; } -//*TODO remake it, instead of returing the list pass it as as parameter (IB) -std::list LLIMModel::getMessages(LLUUID session_id, int start_index) +void LLIMModel::getMessages(const LLUUID& session_id, std::list& messages, int start_index) { - std::list return_list; - LLIMSession* session = findIMSession(session_id); if (!session) { llwarns << "session " << session_id << "does not exist " << llendl; - return return_list; + return; } int i = session->mMsgs.size() - start_index; @@ -317,7 +315,7 @@ std::list LLIMModel::getMessages(LLUUID session_id, int start_index) { LLSD msg; msg = *iter; - return_list.push_back(*iter); + messages.push_back(*iter); i--; } @@ -327,14 +325,9 @@ std::list LLIMModel::getMessages(LLUUID session_id, int start_index) arg["session_id"] = session_id; arg["num_unread"] = 0; mNoUnreadMsgsSignal(arg); - - // TODO: in the future is there a more efficient way to return these - //of course there is - return as parameter (IB) - return return_list; - } -bool LLIMModel::addToHistory(LLUUID session_id, std::string from, LLUUID from_id, std::string utf8_text) { +bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text) { LLIMSession* session = findIMSession(session_id); @@ -383,8 +376,8 @@ bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, con return false; } -//*TODO add const qualifier and pass by references (IB) -bool LLIMModel::addMessage(LLUUID session_id, std::string from, LLUUID from_id, std::string utf8_text, bool log2file /* = true */) { +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); if (!session) @@ -506,7 +499,7 @@ void LLIMModel::sendTypingState(LLUUID session_id, LLUUID other_participant_id, gAgent.sendReliableMessage(); } -void LLIMModel::sendLeaveSession(LLUUID session_id, LLUUID other_participant_id) +void LLIMModel::sendLeaveSession(const LLUUID& session_id, const LLUUID& other_participant_id) { if(session_id.notNull()) { -- cgit v1.2.3 From e874fbc8f052e3a7a16d4b4d61a35a4c49dab1cd Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Mon, 26 Oct 2009 18:05:00 +0200 Subject: IM: got rid of old im floater dependency in LLIMMgr::addMessage(...) --HG-- branch : product-engine --- indra/newview/llimview.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 7414ebbbad..59cd9cec86 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1258,7 +1258,8 @@ void LLIMMgr::addMessage( fixed_session_name = session_name; } - if (!LLIMModel::getInstance()->findIMSession(new_session_id)) + bool new_session = !hasSession(session_id); + if (new_session) { LLIMModel::getInstance()->newSession(session_id, fixed_session_name, dialog, other_participant_id); } @@ -1277,15 +1278,16 @@ void LLIMMgr::addMessage( // create IM window as necessary if(!floater) { - - floater = createFloater( new_session_id, other_participant_id, fixed_session_name, dialog, FALSE); + } + if (new_session) + { // When we get a new IM, and if you are a god, display a bit // of information about the source. This is to help liaisons // when answering questions. @@ -1295,7 +1297,7 @@ void LLIMMgr::addMessage( std::ostringstream bonus_info; bonus_info << LLTrans::getString("***")+ " "+ LLTrans::getString("IMParentEstate") + ":" + " " << parent_estate_id - << ((parent_estate_id == 1) ? "," + LLTrans::getString("IMMainland") : "") + << ((parent_estate_id == 1) ? "," + LLTrans::getString("IMMainland") : "") << ((parent_estate_id == 5) ? "," + LLTrans::getString ("IMTeen") : ""); // once we have web-services (or something) which returns -- cgit v1.2.3 From 6222149487d7e241ad7b009dae1f2fa6f69adc5d Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Tue, 27 Oct 2009 13:16:44 +0200 Subject: IM refactoring: moved voice channel related classes to its own llvoicechannel.* files from dying llimpanel.* files --HG-- branch : product-engine --- indra/newview/llimview.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 59cd9cec86..164da4136f 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -70,6 +70,7 @@ #include "llviewerwindow.h" #include "llnotify.h" #include "llviewerregion.h" +#include "llvoicechannel.h" #include "lltrans.h" #include "llrecentpeople.h" -- cgit v1.2.3 From bfc9445563c5ad200ed609bc8ff3edecb2398d28 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Tue, 27 Oct 2009 14:29:18 +0200 Subject: Implemented major task EXT-1717 (IM related server responses processing stuff should use new IM floater along with the old one) sub-task of EXT-96 (Viewer 2009: Group IM detail). --HG-- branch : product-engine --- indra/newview/llimview.cpp | 149 +++++++++++++++++++++++++++++++++------------ 1 file changed, 111 insertions(+), 38 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 164da4136f..91891fd98e 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -884,20 +884,11 @@ public: { gIMMgr->clearPendingAgentListUpdates(mSessionID); gIMMgr->clearPendingInvitation(mSessionID); - - LLFloaterIMPanel* floaterp = - gIMMgr->findFloaterBySession(mSessionID); - - if ( floaterp ) + if ( 404 == statusNum ) { - if ( 404 == statusNum ) - { - std::string error_string; - error_string = "does not exist"; - - floaterp->showSessionStartError( - error_string); - } + std::string error_string; + error_string = "does not exist"; + gIMMgr->showSessionStartError(error_string, mSessionID); } } } @@ -949,6 +940,106 @@ LLUUID LLIMMgr::computeSessionID( return session_id; } +inline LLFloater* getFloaterBySessionID(const LLUUID session_id) +{ + LLFloater* floater = NULL; + if ( gIMMgr ) + { + floater = dynamic_cast < LLFloater* > + ( gIMMgr->findFloaterBySession(session_id) ); + } + if ( !floater ) + { + floater = dynamic_cast < LLFloater* > + ( LLIMFloater::findInstance(session_id) ); + } + return floater; +} + +void +LLIMMgr::showSessionStartError( + const std::string& error_string, + const LLUUID session_id) +{ + const LLFloater* floater = getFloaterBySessionID (session_id); + if (!floater) return; + + LLSD args; + args["REASON"] = LLTrans::getString(error_string); + args["RECIPIENT"] = floater->getTitle(); + + LLSD payload; + payload["session_id"] = session_id; + + LLNotifications::instance().add( + "ChatterBoxSessionStartError", + args, + payload, + LLIMMgr::onConfirmForceCloseError); +} + +void +LLIMMgr::showSessionEventError( + const std::string& event_string, + const std::string& error_string, + const LLUUID session_id) +{ + const LLFloater* floater = getFloaterBySessionID (session_id); + if (!floater) return; + + LLSD args; + args["REASON"] = + LLTrans::getString(error_string); + args["EVENT"] = + LLTrans::getString(event_string); + args["RECIPIENT"] = floater->getTitle(); + + LLNotifications::instance().add( + "ChatterBoxSessionEventError", + args); +} + +void +LLIMMgr::showSessionForceClose( + const std::string& reason_string, + const LLUUID session_id) +{ + const LLFloater* floater = getFloaterBySessionID (session_id); + if (!floater) return; + + LLSD args; + + args["NAME"] = floater->getTitle(); + args["REASON"] = LLTrans::getString(reason_string); + + LLSD payload; + payload["session_id"] = session_id; + + LLNotifications::instance().add( + "ForceCloseChatterBoxSession", + args, + payload, + LLIMMgr::onConfirmForceCloseError); +} + +//static +bool +LLIMMgr::onConfirmForceCloseError( + const LLSD& notification, + const LLSD& response) +{ + //only 1 option really + LLUUID session_id = notification["payload"]["session_id"]; + + LLFloater* floater = getFloaterBySessionID (session_id); + if ( floater ) + { + floater->closeFloater(FALSE); + } + return false; +} + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLIncomingCallDialog //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2027,15 +2118,8 @@ public: } else { - //throw an error dialog and close the temp session's - //floater - LLFloaterIMPanel* floater = - gIMMgr->findFloaterBySession(temp_session_id); - - if ( floater ) - { - floater->showSessionStartError(body["error"].asString()); - } + //throw an error dialog and close the temp session's floater + gIMMgr->showSessionStartError(body["error"].asString(), temp_session_id); } gIMMgr->clearPendingAgentListUpdates(session_id); @@ -2068,15 +2152,10 @@ public: if ( !success ) { //throw an error dialog - LLFloaterIMPanel* floater = - gIMMgr->findFloaterBySession(session_id); - - if (floater) - { - floater->showSessionEventError( - body["event"].asString(), - body["error"].asString()); - } + gIMMgr->showSessionEventError( + body["event"].asString(), + body["error"].asString(), + session_id); } } }; @@ -2094,13 +2173,7 @@ public: session_id = input["body"]["session_id"].asUUID(); reason = input["body"]["reason"].asString(); - LLFloaterIMPanel* floater = - gIMMgr ->findFloaterBySession(session_id); - - if ( floater ) - { - floater->showSessionForceClose(reason); - } + gIMMgr->showSessionForceClose(reason, session_id); } }; -- cgit v1.2.3 From 3eb7f84b10832d77d8765ea9550108c67c462bcb Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Tue, 27 Oct 2009 18:01:41 +0200 Subject: IM: implemented task EXT-1905 (Add "Call" and "End Call" functionality to new IIM Floater) --HG-- branch : product-engine --- indra/newview/llimview.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 164da4136f..8792713423 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -145,7 +145,8 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& mInitialTargetIDs(ids), mVoiceChannel(NULL), mSpeakers(NULL), - mSessionInitialized(false) + mSessionInitialized(false), + mCallBackEnabled(true) { if (IM_NOTHING_SPECIAL == type || IM_SESSION_P2P_INVITE == type) { @@ -169,6 +170,11 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& //so we're already initialized mSessionInitialized = true; } + + if (IM_NOTHING_SPECIAL == type) + { + mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionID); + } } LLIMModel::LLIMSession::~LLIMSession() -- cgit v1.2.3 From 33af464c441717db855651b70acc4b3636c649a0 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Wed, 28 Oct 2009 14:21:36 +0200 Subject: Implemented major sub-task EXT-1904 (New IM floater should handle Session Update) --HG-- branch : product-engine --- indra/newview/llimview.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 2e5e23c845..a716145590 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2120,6 +2120,15 @@ public: } } + LLIMFloater* im_floater = LLIMFloater::findInstance(session_id); + if ( im_floater ) + { + if ( body.has("session_info") ) + { + im_floater->processSessionUpdate(body["session_info"]); + } + } + gIMMgr->clearPendingAgentListUpdates(session_id); } else @@ -2217,11 +2226,17 @@ public: const LLSD& context, const LLSD& input) const { - LLFloaterIMPanel* floaterp = gIMMgr->findFloaterBySession(input["body"]["session_id"].asUUID()); + LLUUID session_id = input["body"]["session_id"].asUUID(); + LLFloaterIMPanel* floaterp = gIMMgr->findFloaterBySession(session_id); if (floaterp) { floaterp->processSessionUpdate(input["body"]["info"]); } + LLIMFloater* im_floater = LLIMFloater::findInstance(session_id); + if ( im_floater ) + { + im_floater->processSessionUpdate(input["body"]["info"]); + } } }; -- cgit v1.2.3 From a999e50a8ebb3ab641490294d67dbbd6eb0c8898 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Wed, 28 Oct 2009 16:14:52 +0200 Subject: Implemented major sub-task EXT-1912 ( Add handling restrictions of PSTN P2P calls in new IM Floaters ) --HG-- branch : product-engine --- indra/newview/llimview.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index a716145590..b429ae8cf4 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -146,7 +146,9 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& mVoiceChannel(NULL), mSpeakers(NULL), mSessionInitialized(false), - mCallBackEnabled(true) + mCallBackEnabled(true), + mTextIMPossible(true), + mProfileButtonEnabled(true) { if (IM_NOTHING_SPECIAL == type || IM_SESSION_P2P_INVITE == type) { @@ -174,6 +176,8 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& if (IM_NOTHING_SPECIAL == type) { mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionID); + mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionID); + mProfileButtonEnabled = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionID); } } -- cgit v1.2.3 From 4ca9e28f91446c2da413cc1089105278b60c8453 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Wed, 28 Oct 2009 18:44:31 +0200 Subject: No ticket, just renamed mProfileButtonEnabled to mOtherParticipantIsAvatar --HG-- branch : product-engine --- indra/newview/llimview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index b429ae8cf4..a2b6ef6aa5 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -148,7 +148,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& mSessionInitialized(false), mCallBackEnabled(true), mTextIMPossible(true), - mProfileButtonEnabled(true) + mOtherParticipantIsAvatar(true) { if (IM_NOTHING_SPECIAL == type || IM_SESSION_P2P_INVITE == type) { @@ -177,7 +177,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& { mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionID); mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionID); - mProfileButtonEnabled = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionID); + mOtherParticipantIsAvatar = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionID); } } -- cgit v1.2.3 From e8e5dfeb369d13509bd7631230373dda0c3c7b6a Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 28 Oct 2009 20:12:48 +0200 Subject: Fixed critical bug EXT-1918 - [BSI] Region Messages crash the sender and anyone set busy. NOTE - this is temporary workaround to fix the crash. --HG-- branch : product-engine --- indra/newview/llimview.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index b429ae8cf4..6af6ff8705 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1363,7 +1363,12 @@ void LLIMMgr::addMessage( bool new_session = !hasSession(session_id); if (new_session) { - LLIMModel::getInstance()->newSession(session_id, fixed_session_name, dialog, other_participant_id); + // *NOTE dzaporozhan + // Workaround for critical bug EXT-1918 + + // *TODO + // Investigate cases when session_id == NULL and find solution to handle those cases + LLIMModel::getInstance()->newSession(new_session_id, fixed_session_name, dialog, other_participant_id); } floater = findFloaterBySession(new_session_id); -- cgit v1.2.3 From 3a87aa6164e5005dfd193307d8d524cb11fd187f Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Thu, 29 Oct 2009 16:33:10 +0200 Subject: converted workaround to a fix for normal bug EXT-1918 (Region Messages crash the sender and anyone set busy). --HG-- branch : product-engine --- indra/newview/llimview.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 8a55ab41b9..cc848e519f 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1360,14 +1360,9 @@ void LLIMMgr::addMessage( fixed_session_name = session_name; } - bool new_session = !hasSession(session_id); + bool new_session = !hasSession(new_session_id); if (new_session) { - // *NOTE dzaporozhan - // Workaround for critical bug EXT-1918 - - // *TODO - // Investigate cases when session_id == NULL and find solution to handle those cases LLIMModel::getInstance()->newSession(new_session_id, fixed_session_name, dialog, other_participant_id); } -- cgit v1.2.3 From e724fa0ab4c4675b94546f67bd4323704201f4a6 Mon Sep 17 00:00:00 2001 From: Sergey Borushevsky Date: Thu, 29 Oct 2009 20:26:56 +0200 Subject: Implemented major task EXT-1487 (Reimplement chat history persistence using LLSD serialization). Moved loading of IM history from LLIMFloater and LLFloaterIMPanel to LLModel::LLIMSession. Implemented disabling of saving logs if it's disabled in Preferences. --HG-- branch : product-engine --- indra/newview/llimview.cpp | 56 +++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 20 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index cc848e519f..49fc9d8055 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -135,7 +135,6 @@ LLIMModel::LLIMModel() addNewMsgCallback(toast_callback); } - LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const std::vector& ids) : mSessionID(session_id), mName(name), @@ -179,6 +178,9 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionID); mOtherParticipantIsAvatar = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionID); } + + if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") ) + LLLogChat::loadHistory(mName, &chatFromLogFile, (void *)this); } LLIMModel::LLIMSession::~LLIMSession() @@ -220,6 +222,34 @@ void LLIMModel::LLIMSession::sessionInitReplyReceived(const LLUUID& new_session_ } } +void LLIMModel::LLIMSession::addMessage(const std::string& from, const LLUUID& from_id, const std::string& utf8_text, const std::string& time) +{ + LLSD message; + message["from"] = from; + message["from_id"] = from_id; + message["message"] = utf8_text; + message["time"] = time; + message["index"] = (LLSD::Integer)mMsgs.size(); + + mMsgs.push_front(message); +} + +void LLIMModel::LLIMSession::chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata) +{ + if (!userdata) return; + + LLIMSession* self = (LLIMSession*) userdata; + + if (type == LLLogChat::LOG_LINE) + { + self->addMessage("", LLSD(), msg["message"].asString(), ""); + } + else if (type == LLLogChat::LOG_LLSD) + { + self->addMessage(msg["from"].asString(), msg["from_id"].asUUID(), msg["message"].asString(), msg["time"].asString()); + } +} + LLIMModel::LLIMSession* LLIMModel::findIMSession(const LLUUID& session_id) const { return get_if_there(LLIMModel::instance().sSessionsMap, session_id, @@ -348,39 +378,25 @@ bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from, return false; } - LLSD message; - message["from"] = from; - message["from_id"] = from_id; - message["message"] = utf8_text; - message["time"] = LLLogChat::timestamp(false); //might want to add date separately - message["index"] = (LLSD::Integer)session->mMsgs.size(); - - session->mMsgs.push_front(message); + session->addMessage(from, from_id, utf8_text, LLLogChat::timestamp(false)); //might want to add date separately return true; - } //*TODO rewrite chat history persistence using LLSD serialization (IB) -bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, const std::string& utf8_text) +bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text) { S32 im_log_option = gSavedPerAccountSettings.getS32("IMLogOptions"); if (im_log_option != LOG_CHAT) { - std::string histstr; - if (gSavedPerAccountSettings.getBOOL("LogTimestamp")) - histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + from + IM_SEPARATOR + utf8_text; - else - histstr = from + IM_SEPARATOR + utf8_text; - if(im_log_option == LOG_BOTH_TOGETHER) { - LLLogChat::saveHistory(std::string("chat"), histstr); + LLLogChat::saveHistory(std::string("chat"), from, from_id, utf8_text); return true; } else { - LLLogChat::saveHistory(LLIMModel::getInstance()->getName(session_id), histstr); + LLLogChat::saveHistory(LLIMModel::getInstance()->getName(session_id), from, from_id, utf8_text); return true; } } @@ -398,7 +414,7 @@ bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, co } addToHistory(session_id, from, from_id, utf8_text); - if (log2file) logToFile(session_id, from, utf8_text); + if (log2file) logToFile(session_id, from, from_id, utf8_text); session->mNumUnread++; -- cgit v1.2.3 From 788b08f525ebfcc52ae1cf351d796594cf71f5c1 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Mon, 2 Nov 2009 15:51:43 +0200 Subject: Fixed normal bug EXT-1877([BSI] Offline status not showing in IMs) --HG-- branch : product-engine --- indra/newview/llimview.cpp | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'indra/newview/llimview.cpp') 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); } } } -- cgit v1.2.3 From d3d53c9e41f6de250e7bd059d4120b9be08d31da Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Mon, 2 Nov 2009 16:59:43 +0200 Subject: IM: cleaned u TODO marks and completed minor TODOs. --HG-- branch : product-engine --- indra/newview/llimview.cpp | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 41e2cff3b7..cdcb284cee 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -89,9 +89,6 @@ LLIMMgr* gIMMgr = NULL; const static std::string IM_SEPARATOR(": "); -std::map LLIMModel::sSessionsMap; - - void toast_callback(const LLSD& msg){ // do not show toast in busy mode or it goes from agent @@ -238,6 +235,12 @@ void LLIMModel::LLIMSession::addMessage(const std::string& from, const LLUUID& f message["index"] = (LLSD::Integer)mMsgs.size(); mMsgs.push_front(message); + + if (mSpeakers && from_id.notNull()) + { + mSpeakers->speakerChatted(from_id); + mSpeakers->setSpeakerTyping(from_id, FALSE); + } } void LLIMModel::LLIMSession::chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata) @@ -258,12 +261,11 @@ void LLIMModel::LLIMSession::chatFromLogFile(LLLogChat::ELogLineType type, const LLIMModel::LLIMSession* LLIMModel::findIMSession(const LLUUID& session_id) const { - return get_if_there(LLIMModel::instance().sSessionsMap, session_id, + return get_if_there(mId2SessionMap, session_id, (LLIMModel::LLIMSession*) NULL); } -//*TODO change name to represent session initialization aspect (IB) -void LLIMModel::updateSessionID(const LLUUID& old_session_id, const LLUUID& new_session_id) +void LLIMModel::processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id) { LLIMSession* session = findIMSession(old_session_id); if (session) @@ -272,8 +274,8 @@ void LLIMModel::updateSessionID(const LLUUID& old_session_id, const LLUUID& new_ if (old_session_id != new_session_id) { - sSessionsMap.erase(old_session_id); - sSessionsMap[new_session_id] = session; + mId2SessionMap.erase(old_session_id); + mId2SessionMap[new_session_id] = session; gIMMgr->notifyObserverSessionIDUpdated(old_session_id, new_session_id); } @@ -322,14 +324,14 @@ void LLIMModel::testMessages() bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const std::vector& ids) { - if (is_in_map(sSessionsMap, session_id)) + if (findIMSession(session_id)) { llwarns << "IM Session " << session_id << " already exists" << llendl; return false; } LLIMSession* session = new LLIMSession(session_id, name, type, other_participant_id, ids); - sSessionsMap[session_id] = session; + mId2SessionMap[session_id] = session; LLIMMgr::getInstance()->notifyObserverSessionAdded(session_id, name, other_participant_id); @@ -339,9 +341,9 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co bool LLIMModel::clearSession(const LLUUID& session_id) { - if (sSessionsMap.find(session_id) == sSessionsMap.end()) return false; - delete (sSessionsMap[session_id]); - sSessionsMap.erase(session_id); + if (mId2SessionMap.find(session_id) == mId2SessionMap.end()) return false; + delete (mId2SessionMap[session_id]); + mId2SessionMap.erase(session_id); return true; } @@ -389,7 +391,6 @@ bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from, return true; } -//*TODO rewrite chat history persistence using LLSD serialization (IB) bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text) { S32 im_log_option = gSavedPerAccountSettings.getS32("IMLogOptions"); @@ -570,8 +571,7 @@ void LLIMModel::sendLeaveSession(const LLUUID& session_id, const LLUUID& other_p } } - -//*TODO update list of messages in a LLIMSession (IB) +//*TODO this method is better be moved to the LLIMMgr void LLIMModel::sendMessage(const std::string& utf8_text, const LLUUID& im_session_id, const LLUUID& other_participant_id, @@ -1466,14 +1466,6 @@ void LLIMMgr::addMessage( else { floater->addHistoryLine(msg, color, true, other_participant_id, from); // Insert linked name to front of message - - //*TODO consider moving that speaker management stuff into model (IB) - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(new_session_id); - if (speaker_mgr) - { - speaker_mgr->speakerChatted(gAgentID); - speaker_mgr->setSpeakerTyping(gAgentID, FALSE); - } } LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg); @@ -1539,7 +1531,7 @@ S32 LLIMMgr::getNumberOfUnreadIM() std::map::iterator it; S32 num = 0; - for(it = LLIMModel::sSessionsMap.begin(); it != LLIMModel::sSessionsMap.end(); ++it) + for(it = LLIMModel::getInstance()->mId2SessionMap.begin(); it != LLIMModel::getInstance()->mId2SessionMap.end(); ++it) { num += (*it).second->mNumUnread; } @@ -2139,7 +2131,7 @@ public: { session_id = body["session_id"].asUUID(); - LLIMModel::getInstance()->updateSessionID(temp_session_id, session_id); + LLIMModel::getInstance()->processSessionInitializedReply(temp_session_id, session_id); LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id); if (speaker_mgr) -- cgit v1.2.3 From 265805a1b02555c01f9f2ac42000dbc731ab31c6 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Mon, 2 Nov 2009 17:33:42 +0200 Subject: fixed low bug EXT-1941 'User is offline' message appears every time you performe double mouse click on avatar's while IM has been already started --HG-- branch : product-engine --- indra/newview/llimview.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index cdcb284cee..66a3e3e85c 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1597,7 +1597,9 @@ LLUUID LLIMMgr::addSession( LLUUID session_id = computeSessionID(dialog,other_participant_id); - if (!LLIMModel::getInstance()->findIMSession(session_id)) + bool new_session = !LLIMModel::getInstance()->findIMSession(session_id); + + if (new_session) { LLIMModel::getInstance()->newSession(session_id, name, dialog, other_participant_id, ids); } @@ -1619,6 +1621,9 @@ LLUUID LLIMMgr::addSession( ids); } + //we don't need to show notes about online/offline, mute/unmute users' statuses for existing sessions + if (!new_session) return session_id; + noteOfflineUsers(session_id, floater, ids); // Only warn for regular IMs - not group IMs @@ -1627,8 +1632,6 @@ LLUUID LLIMMgr::addSession( noteMutedUsers(session_id, floater, ids); } - - return session_id; } -- cgit v1.2.3