summaryrefslogtreecommitdiff
path: root/indra/newview/llchathistory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rw-r--r--indra/newview/llchathistory.cpp95
1 files changed, 43 insertions, 52 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 0fdef20f4a..68c31d87fa 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -2,25 +2,31 @@
* @file llchathistory.cpp
* @brief LLTextEditor base class
*
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
*
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
@@ -105,12 +111,6 @@ public:
return pInstance;
}
- ~LLChatHistoryHeader()
- {
- // Detach the info button so that it doesn't get destroyed (EXT-8463).
- hideInfoCtrl();
- }
-
BOOL handleMouseUp(S32 x, S32 y, MASK mask)
{
return LLPanel::handleMouseUp(x,y,mask);
@@ -243,7 +243,7 @@ public:
gCacheName->get(mAvatarID, FALSE, boost::bind(&LLChatHistoryHeader::nameUpdatedCallback, this, _1, _2, _3, _4));
//*TODO overly defensive thing, source type should be maintained out there
- if((chat.mFromID.isNull() && chat.mFromName.empty()) || chat.mFromName == SYSTEM_FROM && chat.mFromID.isNull())
+ if((chat.mFromID.isNull() && chat.mFromName.empty()) || chat.mFromName == SYSTEM_FROM)
{
mSourceType = CHAT_SOURCE_SYSTEM;
}
@@ -382,18 +382,8 @@ protected:
if (!sInfoCtrl)
{
- // *TODO: Delete the button at exit.
sInfoCtrl = LLUICtrlFactory::createFromFile<LLUICtrl>("inspector_info_ctrl.xml", NULL, LLPanel::child_registry_t::instance());
- if (sInfoCtrl)
- {
- sInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, sInfoCtrl));
- }
- }
-
- if (!sInfoCtrl)
- {
- llassert(sInfoCtrl != NULL);
- return;
+ sInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, sInfoCtrl));
}
LLTextBase* name = getChild<LLTextBase>("user_name");
@@ -567,14 +557,6 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
{
bool use_plain_text_chat_history = args["use_plain_text_chat_history"].asBoolean();
- llassert(mEditor);
- if (!mEditor)
- {
- return;
- }
-
- mEditor->setPlainText(use_plain_text_chat_history);
-
if (!mEditor->scrolledToEnd() && chat.mFromID != gAgent.getID() && !chat.mFromName.empty())
{
mUnreadChatSources.insert(chat.mFromName);
@@ -665,21 +647,22 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
if ( chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mFromID.notNull())
{
// for object IMs, create a secondlife:///app/objectim SLapp
- std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString();
+ std::string url = LLSLURL::buildCommand("objectim", chat.mFromID, "");
url += "?name=" + chat.mFromName;
- url += "&owner=" + chat.mOwnerID.asString();
+ url += "&owner=" + args["owner_id"].asString();
std::string slurl = args["slurl"].asString();
if (slurl.empty())
{
- LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
- if(region)
- {
- LLSLURL region_slurl(region->getName(), chat.mPosAgent);
- slurl = region_slurl.getLocationString();
- }
+ LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
+ if (region)
+ {
+ S32 x, y, z;
+ LLSLURL::globalPosToXYZ(LLVector3d(chat.mPosAgent), x, y, z);
+ slurl = region->getName() + llformat("/%d/%d/%d", x, y, z);
+ }
}
- url += "&slurl=" + LLURI::escape(slurl);
+ url += "&slurl=" + slurl;
// set the link for the object name to be the objectim SLapp
// (don't let object names with hyperlinks override our objectim Url)
@@ -753,7 +736,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
mIsLastMessageFromLog = message_from_log;
}
- if (chat.mNotifId.notNull())
+ if (chat.mNotifId.notNull())
{
LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId);
if (notification != NULL)
@@ -845,7 +828,6 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
mEditor->appendText(message, FALSE, style_params);
}
-
mEditor->blockUndo();
// automatically scroll to end when receiving chat from myself
@@ -865,3 +847,12 @@ void LLChatHistory::draw()
LLUICtrl::draw();
}
+
+void LLChatHistory::reshape(S32 width, S32 height, BOOL called_from_parent)
+{
+ bool is_scrolled_to_end = mEditor->scrolledToEnd();
+ LLUICtrl::reshape( width, height, called_from_parent );
+ // update scroll
+ if (is_scrolled_to_end)
+ mEditor->setCursorAndScrollToEnd();
+}