summaryrefslogtreecommitdiff
path: root/indra/newview/llimview.cpp
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-02-03 14:13:56 -0800
committerJames Cook <james@lindenlab.com>2010-02-03 14:13:56 -0800
commit88350edbcbec615f3b15fc82bd5ce4005621ac6f (patch)
treec244f41159cf32f3e03c6c311e1453bbd383bad5 /indra/newview/llimview.cpp
parentd489216b6ef41f0d22f3a9062ba6daacc67bc038 (diff)
parent0bee31de32cb5999e7ec06d74f55d34ce0ac052b (diff)
merge
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r--indra/newview/llimview.cpp321
1 files changed, 47 insertions, 274 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 9cc4aefe35..f3de5a2543 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -52,7 +52,6 @@
#include "llbottomtray.h"
#include "llcallingcard.h"
#include "llchat.h"
-#include "llfloaterchatterbox.h"
#include "llimfloater.h"
#include "llgroupiconctrl.h"
#include "llmd5.h"
@@ -64,8 +63,10 @@
#include "llnotificationsutil.h"
#include "llnearbychat.h"
#include "llspeakers.h" //for LLIMSpeakerMgr
+#include "lltextbox.h"
#include "lltextutil.h"
#include "llviewercontrol.h"
+#include "llviewerparcelmgr.h"
const static std::string IM_TIME("time");
@@ -95,7 +96,8 @@ void toast_callback(const LLSD& msg){
}
// check whether incoming IM belongs to an active session or not
- if (LLIMModel::getInstance()->getActiveSessionID() == msg["session_id"])
+ if (LLIMModel::getInstance()->getActiveSessionID().notNull()
+ && LLIMModel::getInstance()->getActiveSessionID() == msg["session_id"])
{
return;
}
@@ -536,13 +538,6 @@ void LLIMModel::processSessionInitializedReply(const LLUUID& old_session_id, con
gIMMgr->startCall(new_session_id);
}
}
-
- //*TODO remove this "floater" stuff when Communicate Floater is gone
- LLFloaterIMPanel* floater = gIMMgr->findFloaterBySession(old_session_id);
- if (floater)
- {
- floater->sessionInitReplyReceived(new_session_id);
- }
}
void LLIMModel::testMessages()
@@ -677,15 +672,6 @@ 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);
}
@@ -953,9 +939,6 @@ void LLIMModel::sendMessage(const std::string& utf8_text,
history_echo += ": " + utf8_text;
- LLFloaterIMPanel* floater = gIMMgr->findFloaterBySession(im_session_id);
- if (floater) floater->addHistoryLine(history_echo, LLUIColorTable::instance().getColor("IMChatColor"), true, gAgent.getID());
-
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(im_session_id);
if (speaker_mgr)
{
@@ -1273,33 +1256,16 @@ 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;
+ if (!hasSession(session_id)) return;
LLSD args;
args["REASON"] = LLTrans::getString(error_string);
- args["RECIPIENT"] = floater->getTitle();
+ args["RECIPIENT"] = LLIMModel::getInstance()->getName(session_id);
LLSD payload;
payload["session_id"] = session_id;
@@ -1337,12 +1303,11 @@ LLIMMgr::showSessionForceClose(
const std::string& reason_string,
const LLUUID session_id)
{
- const LLFloater* floater = getFloaterBySessionID (session_id);
- if (!floater) return;
+ if (!hasSession(session_id)) return;
LLSD args;
- args["NAME"] = floater->getTitle();
+ args["NAME"] = LLIMModel::getInstance()->getName(session_id);
args["REASON"] = LLTrans::getString(reason_string);
LLSD payload;
@@ -1364,7 +1329,7 @@ LLIMMgr::onConfirmForceCloseError(
//only 1 option really
LLUUID session_id = notification["payload"]["session_id"];
- LLFloater* floater = getFloaterBySessionID (session_id);
+ LLFloater* floater = LLIMFloater::findInstance(session_id);
if ( floater )
{
floater->closeFloater(FALSE);
@@ -1496,10 +1461,13 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLCallDialog
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LLCallDialog::LLCallDialog(const LLSD& payload) :
-LLDockableFloater(NULL, false, payload),
-mPayload(payload)
+LLCallDialog::LLCallDialog(const LLSD& payload)
+ : LLDockableFloater(NULL, false, payload),
+
+ mPayload(payload),
+ mLifetime(DEFAULT_LIFETIME)
{
+ setAutoFocus(FALSE);
}
void LLCallDialog::getAllowedRect(LLRect& rect)
@@ -1577,7 +1545,7 @@ void LLCallDialog::setIcon(const LLSD& session_id, const LLSD& participant_id)
}
}
-bool LLOutgoingCallDialog::lifetimeHasExpired()
+bool LLCallDialog::lifetimeHasExpired()
{
if (mLifetimeTimer.getStarted())
{
@@ -1590,7 +1558,7 @@ bool LLOutgoingCallDialog::lifetimeHasExpired()
return false;
}
-void LLOutgoingCallDialog::onLifetimeExpired()
+void LLCallDialog::onLifetimeExpired()
{
mLifetimeTimer.stop();
closeFloater();
@@ -1600,6 +1568,9 @@ void LLOutgoingCallDialog::show(const LLSD& key)
{
mPayload = key;
+ //will be false only if voice in parcel is disabled and channel we leave is nearby(checked further)
+ bool show_oldchannel = LLViewerParcelMgr::getInstance()->allowAgentVoice();
+
// hide all text at first
hideAllText();
@@ -1623,10 +1594,11 @@ void LLOutgoingCallDialog::show(const LLSD& key)
}
childSetTextArg("leaving", "[CURRENT_CHAT]", old_caller_name);
+ show_oldchannel = true;
}
else
{
- childSetTextArg("leaving", "[CURRENT_CHAT]", getString("localchat"));
+ childSetTextArg("leaving", "[CURRENT_CHAT]", getString("localchat"));
}
if (!mPayload["disconnected_channel_name"].asString().empty())
@@ -1671,15 +1643,22 @@ void LLOutgoingCallDialog::show(const LLSD& key)
{
case LLVoiceChannel::STATE_CALL_STARTED :
getChild<LLTextBox>("calling")->setVisible(true);
- getChild<LLTextBox>("leaving")->setVisible(true);
+ if(show_oldchannel)
+ {
+ getChild<LLTextBox>("leaving")->setVisible(true);
+ }
break;
case LLVoiceChannel::STATE_RINGING :
- getChild<LLTextBox>("leaving")->setVisible(true);
+ if(show_oldchannel)
+ {
+ getChild<LLTextBox>("leaving")->setVisible(true);
+ }
getChild<LLTextBox>("connecting")->setVisible(true);
break;
case LLVoiceChannel::STATE_ERROR :
getChild<LLTextBox>("noanswer")->setVisible(true);
getChild<LLButton>("Cancel")->setVisible(false);
+ setCanClose(true);
mLifetimeTimer.start();
break;
case LLVoiceChannel::STATE_HUNG_UP :
@@ -1692,6 +1671,7 @@ void LLOutgoingCallDialog::show(const LLSD& key)
getChild<LLTextBox>("nearby")->setVisible(true);
}
getChild<LLButton>("Cancel")->setVisible(false);
+ setCanClose(true);
mLifetimeTimer.start();
}
@@ -1729,6 +1709,8 @@ BOOL LLOutgoingCallDialog::postBuild()
childSetAction("Cancel", onCancel, this);
+ setCanDrag(FALSE);
+
return success;
}
@@ -1742,19 +1724,6 @@ LLCallDialog(payload)
{
}
-bool LLIncomingCallDialog::lifetimeHasExpired()
-{
- if (mLifetimeTimer.getStarted())
- {
- F32 elapsed_time = mLifetimeTimer.getElapsedTimeF32();
- if (elapsed_time > mLifetime)
- {
- return true;
- }
- }
- return false;
-}
-
void LLIncomingCallDialog::onLifetimeExpired()
{
// check whether a call is valid or not
@@ -1767,6 +1736,9 @@ void LLIncomingCallDialog::onLifetimeExpired()
{
// close invitation if call is already not valid
mLifetimeTimer.stop();
+ LLUUID session_id = mPayload["session_id"].asUUID();
+ gIMMgr->clearPendingAgentListUpdates(session_id);
+ gIMMgr->clearPendingInvitation(session_id);
closeFloater();
}
}
@@ -1825,7 +1797,7 @@ BOOL LLIncomingCallDialog::postBuild()
childSetAction("Accept", onAccept, this);
childSetAction("Reject", onReject, this);
childSetAction("Start IM", onStartIM, this);
- childSetFocus("Accept");
+ setDefaultBtn("Accept");
std::string notify_box_type = mPayload["notify_box_type"].asString();
if(notify_box_type != "VoiceInviteGroup" && notify_box_type != "VoiceInviteAdHoc")
@@ -1838,6 +1810,8 @@ BOOL LLIncomingCallDialog::postBuild()
mLifetimeTimer.stop();
}
+ setCanDrag(FALSE);
+
return TRUE;
}
@@ -2111,8 +2085,7 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
// Member Functions
//
-LLIMMgr::LLIMMgr() :
- mIMReceived(FALSE)
+LLIMMgr::LLIMMgr()
{
mPendingInvitations = LLSD::emptyMap();
mPendingAgentListUpdates = LLSD::emptyMap();
@@ -2143,7 +2116,6 @@ void LLIMMgr::addMessage(
return;
}
- LLFloaterIMPanel* floater;
LLUUID new_session_id = session_id;
if (new_session_id.isNull())
{
@@ -2162,32 +2134,7 @@ void LLIMMgr::addMessage(
if (new_session)
{
LLIMModel::getInstance()->newSession(new_session_id, fixed_session_name, dialog, other_participant_id);
- }
-
- floater = findFloaterBySession(new_session_id);
- if (!floater)
- {
- floater = findFloaterBySession(other_participant_id);
- if (floater)
- {
- llinfos << "found the IM session " << session_id
- << " by participant " << other_participant_id << llendl;
- }
- }
-
- // 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.
@@ -2206,50 +2153,13 @@ void LLIMMgr::addMessage(
//<< "*** region_id: " << region_id << std::endl
//<< "*** position: " << position << std::endl;
- floater->addHistoryLine(bonus_info.str(), LLUIColorTable::instance().getColor("SystemChatColor"));
LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, bonus_info.str());
}
make_ui_sound("UISndNewIncomingIMSession");
}
- // now add message to floater
- bool is_from_system = target_id.isNull() || (from == SYSTEM_FROM);
- const LLColor4& color = ( is_from_system ?
- LLUIColorTable::instance().getColor("SystemChatColor") :
- LLUIColorTable::instance().getColor("IMChatColor"));
- if ( !link_name )
- {
- floater->addHistoryLine(msg,color); // No name to prepend, so just add the message normally
- }
- else
- {
- floater->addHistoryLine(msg, color, true, other_participant_id, from); // Insert linked name to front of message
- }
-
LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg);
-
- 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();
-
- // select the newly added floater (or the floater with the new line added to it).
- // it should be there.
- chat_floater->selectFloater(floater);
-
- //there was a previously unseen IM, make that old tab flashing
- //it is assumed that the most recently unseen IM tab is the one current selected/active
- if ( previouslyActiveFloater && getIMReceived() )
- {
- chat_floater->setFloaterFlashing(previouslyActiveFloater, TRUE);
- }
-
- //notify of a new IM
- notifyNewIM();
- }
}
void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args)
@@ -2282,14 +2192,6 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess
}
}
-void LLIMMgr::notifyNewIM()
-{
- if(!LLFloaterReg::instanceVisible("communicate"))
- {
- mIMReceived = TRUE;
- }
-}
-
S32 LLIMMgr::getNumberOfUnreadIM()
{
std::map<LLUUID, LLIMModel::LLIMSession*>::iterator it;
@@ -2316,16 +2218,6 @@ S32 LLIMMgr::getNumberOfUnreadParticipantMessages()
return num;
}
-void LLIMMgr::clearNewIMNotification()
-{
- mIMReceived = FALSE;
-}
-
-BOOL LLIMMgr::getIMReceived() const
-{
- return mIMReceived;
-}
-
void LLIMMgr::autoStartCallOnStartup(const LLUUID& session_id)
{
LLIMModel::LLIMSession *session = LLIMModel::getInstance()->findIMSession(session_id);
@@ -2413,21 +2305,6 @@ LLUUID LLIMMgr::addSession(
LLIMModel::getInstance()->newSession(session_id, name, dialog, other_participant_id, ids, voice);
}
- //*TODO remove this "floater" thing when Communicate Floater's gone
- LLFloaterIMPanel* floater = findFloaterBySession(session_id);
- if(!floater)
- {
- // On creation, use the first element of ids as the
- // "other_participant_id"
- floater = createFloater(
- session_id,
- other_participant_id,
- name,
- dialog,
- TRUE,
- ids);
- }
-
//we don't need to show notes about online/offline, mute/unmute users' statuses for existing sessions
if (!new_session) return session_id;
@@ -2438,7 +2315,7 @@ LLUUID LLIMMgr::addSession(
// Only warn for regular IMs - not group IMs
if( dialog == IM_NOTHING_SPECIAL )
{
- noteMutedUsers(session_id, floater, ids);
+ noteMutedUsers(session_id, ids);
}
return session_id;
@@ -2459,14 +2336,6 @@ void LLIMMgr::removeSession(const LLUUID& session_id)
{
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);
- }
-
clearPendingInvitation(session_id);
clearPendingAgentListUpdates(session_id);
@@ -2561,7 +2430,7 @@ void LLIMMgr::inviteToSession(
}
else
{
- LLFloaterReg::showInstance("incoming_call", payload, TRUE);
+ LLFloaterReg::showInstance("incoming_call", payload, FALSE);
}
mPendingInvitations[session_id.asString()] = LLSD();
}
@@ -2574,53 +2443,15 @@ void LLIMMgr::onInviteNameLookup(LLSD payload, const LLUUID& id, const std::stri
std::string notify_box_type = payload["notify_box_type"].asString();
- LLFloaterReg::showInstance("incoming_call", payload, TRUE);
+ LLFloaterReg::showInstance("incoming_call", payload, FALSE);
}
+//*TODO disconnects all sessions
void LLIMMgr::disconnectAllSessions()
{
- LLFloaterIMPanel* floater = NULL;
- std::set<LLHandle<LLFloater> >::iterator handle_it;
- for(handle_it = mFloaters.begin();
- handle_it != mFloaters.end();
- )
- {
- floater = (LLFloaterIMPanel*)handle_it->get();
-
- // MUST do this BEFORE calling floater->onClose() because that may remove the item from the set, causing the subsequent increment to crash.
- ++handle_it;
-
- if (floater)
- {
- floater->setEnabled(FALSE);
- floater->closeFloater(TRUE);
- }
- }
-}
-
-
-// This method returns the im panel corresponding to the uuid
-// provided. The uuid can either be a session id or an agent
-// id. Returns NULL if there is no matching panel.
-LLFloaterIMPanel* LLIMMgr::findFloaterBySession(const LLUUID& session_id)
-{
- LLFloaterIMPanel* rv = NULL;
- std::set<LLHandle<LLFloater> >::iterator handle_it;
- for(handle_it = mFloaters.begin();
- handle_it != mFloaters.end();
- ++handle_it)
- {
- rv = (LLFloaterIMPanel*)handle_it->get();
- if(rv && session_id == rv->getSessionID())
- {
- break;
- }
- rv = NULL;
- }
- return rv;
+ //*TODO disconnects all IM sessions
}
-
BOOL LLIMMgr::hasSession(const LLUUID& session_id)
{
return LLIMModel::getInstance()->findIMSession(session_id) != NULL;
@@ -2804,49 +2635,14 @@ bool LLIMMgr::isVoiceCall(const LLUUID& session_id)
return im_session->mStartedAsIMCall;
}
-// create a floater and update internal representation for
-// consistency. Returns the pointer, caller (the class instance since
-// it is a private method) is not responsible for deleting the
-// pointer. Add the floater to this but do not select it.
-LLFloaterIMPanel* LLIMMgr::createFloater(
- const LLUUID& session_id,
- const LLUUID& other_participant_id,
- const std::string& session_label,
- EInstantMessage dialog,
- BOOL user_initiated,
- const LLDynamicArray<LLUUID>& ids)
-{
- if (session_id.isNull())
- {
- llwarns << "Creating LLFloaterIMPanel with null session ID" << llendl;
- }
-
- llinfos << "LLIMMgr::createFloater: from " << other_participant_id
- << " in session " << session_id << llendl;
- 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()->addFloater(floater, FALSE, i_pt);
- mFloaters.insert(floater->getHandle());
- return floater;
-}
-
void LLIMMgr::noteOfflineUsers(
const LLUUID& session_id,
- LLFloaterIMPanel* floater,
const LLDynamicArray<LLUUID>& ids)
{
S32 count = ids.count();
if(count == 0)
{
const std::string& only_user = LLTrans::getString("only_user_message");
- if (floater)
- {
- floater->addHistoryLine(only_user, LLUIColorTable::instance().getColor("SystemChatColor"));
- }
LLIMModel::getInstance()->addMessage(session_id, SYSTEM_FROM, LLUUID::null, only_user);
}
else
@@ -2870,7 +2666,7 @@ void LLIMMgr::noteOfflineUsers(
}
}
-void LLIMMgr::noteMutedUsers(const LLUUID& session_id, LLFloaterIMPanel* floater,
+void LLIMMgr::noteMutedUsers(const LLUUID& session_id,
const LLDynamicArray<LLUUID>& ids)
{
// Don't do this if we don't have a mute list.
@@ -2891,9 +2687,6 @@ void LLIMMgr::noteMutedUsers(const LLUUID& session_id, LLFloaterIMPanel* floater
{
LLUIString muted = LLTrans::getString("muted_message");
- //*TODO remove this "floater" thing when Communicate Floater's gone
- floater->addHistoryLine(muted);
-
im_model->addMessage(session_id, SYSTEM_FROM, LLUUID::null, muted);
break;
}
@@ -2914,12 +2707,6 @@ void LLIMMgr::processIMTypingStop(const LLIMInfo* im_info)
void LLIMMgr::processIMTypingCore(const LLIMInfo* im_info, BOOL typing)
{
LLUUID session_id = computeSessionID(im_info->mIMType, im_info->mFromID);
- LLFloaterIMPanel* floater = findFloaterBySession(session_id);
- if (floater)
- {
- floater->processIMTyping(im_info, typing);
- }
-
LLIMFloater* im_floater = LLIMFloater::findInstance(session_id);
if ( im_floater )
{
@@ -2965,15 +2752,6 @@ public:
speaker_mgr->updateSpeakers(gIMMgr->getPendingAgentListUpdates(session_id));
}
- LLFloaterIMPanel* floaterp = gIMMgr->findFloaterBySession(session_id);
- if (floaterp)
- {
- if ( body.has("session_info") )
- {
- floaterp->processSessionUpdate(body["session_info"]);
- }
- }
-
LLIMFloater* im_floater = LLIMFloater::findInstance(session_id);
if ( im_floater )
{
@@ -3068,11 +2846,6 @@ public:
const LLSD& input) const
{
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 )
{