summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-02-02 23:47:48 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-02-03 20:05:20 +0200
commit1dd32bb772bb2f0d6d4f3180965a8bdcf9c1000d (patch)
tree611ed458baf6aa6754051802a5c20d506f6fc570 /indra
parent2cf9c01175b8092c3979199302bfaa3ec1471aa8 (diff)
SL-14796 After teleporting, add notation into Nearby Chat
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llchat.h6
-rw-r--r--indra/newview/llagent.cpp60
-rw-r--r--indra/newview/llagent.h3
-rw-r--r--indra/newview/llchathistory.cpp62
-rw-r--r--indra/newview/llviewerdisplay.cpp1
-rw-r--r--indra/newview/skins/default/colors.xml3
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml3
7 files changed, 120 insertions, 18 deletions
diff --git a/indra/llui/llchat.h b/indra/llui/llchat.h
index f5b242fdfc..c39e44200c 100644
--- a/indra/llui/llchat.h
+++ b/indra/llui/llchat.h
@@ -37,7 +37,8 @@ typedef enum e_chat_source_type
CHAT_SOURCE_SYSTEM = 0,
CHAT_SOURCE_AGENT = 1,
CHAT_SOURCE_OBJECT = 2,
- CHAT_SOURCE_UNKNOWN = 3
+ CHAT_SOURCE_TELEPORT = 3,
+ CHAT_SOURCE_UNKNOWN = 4
} EChatSourceType;
typedef enum e_chat_type
@@ -64,7 +65,8 @@ typedef enum e_chat_style
{
CHAT_STYLE_NORMAL,
CHAT_STYLE_IRC,
- CHAT_STYLE_HISTORY
+ CHAT_STYLE_HISTORY,
+ CHAT_STYLE_TELEPORT_SEP
}EChatStyle;
// A piece of chat
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index c65bc0fa50..f31135ad4c 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -519,6 +519,10 @@ void LLAgent::cleanup()
{
mTeleportFailedSlot.disconnect();
}
+ if (mParcelMgrConnection.connected())
+ {
+ mParcelMgrConnection.disconnect();
+ }
}
//-----------------------------------------------------------------------------
@@ -3934,6 +3938,10 @@ void LLAgent::clearTeleportRequest()
LLVoiceClient::getInstance()->setHidden(FALSE);
}
mTeleportRequest.reset();
+ if (mParcelMgrConnection.connected())
+ {
+ mParcelMgrConnection.disconnect();
+ }
}
void LLAgent::setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange)
@@ -3942,6 +3950,12 @@ void LLAgent::setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange)
mMaturityRatingChange = pMaturityRatingChange;
}
+void LLAgent::sheduleTeleportIM()
+{
+ // is supposed to be called during teleport so we are still waiting for parcel
+ mParcelMgrConnection = addParcelChangedCallback(onParcelReadyAfterTeleport);
+}
+
bool LLAgent::hasPendingTeleportRequest()
{
return ((mTeleportRequest != NULL) &&
@@ -4051,6 +4065,52 @@ void LLAgent::handleTeleportFailed()
LLNotificationsUtil::add("PreferredMaturityChanged", args);
mIsMaturityRatingChangingDuringTeleport = false;
}
+
+ if (mParcelMgrConnection.connected())
+ {
+ mParcelMgrConnection.disconnect();
+ }
+}
+
+/*static*/
+void LLAgent::onParcelReadyAfterTeleport()
+{
+ LLViewerRegion* agent_region = gAgent.getRegion();
+ LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (!agent_region || !agent_parcel)
+ {
+ return;
+ }
+
+ LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
+ if (nearby_chat)
+ {
+ std::string location_name;
+ LLAgentUI::ELocationFormat format = LLAgentUI::LOCATION_FORMAT_NO_MATURITY;
+
+ // Might be better to provide slurl to chat
+ if (!LLAgentUI::buildLocationString(location_name, format))
+ {
+ location_name = "Teleport to new region"; // Shouldn't happen
+ }
+
+ LLChat chat;
+ chat.mFromName = location_name;
+ chat.mMuted = FALSE;
+ chat.mFromID = LLUUID::null;
+ chat.mSourceType = CHAT_SOURCE_TELEPORT;
+ chat.mChatStyle = CHAT_STYLE_TELEPORT_SEP;
+ chat.mText = "";
+
+ LLSD args;
+ args["do_not_log"] = TRUE;
+ nearby_chat->addMessage(chat, true, args);
+ }
+
+ if (gAgent.mParcelMgrConnection.connected())
+ {
+ gAgent.mParcelMgrConnection.disconnect();
+ }
}
/*static*/
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index d46c99db8c..8f8c2f6007 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -653,6 +653,7 @@ public:
void restartFailedTeleportRequest();
void clearTeleportRequest();
void setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange);
+ void sheduleTeleportIM();
private:
@@ -667,6 +668,7 @@ private:
LLTeleportRequestPtr mTeleportCanceled;
boost::signals2::connection mTeleportFinishedSlot;
boost::signals2::connection mTeleportFailedSlot;
+ boost::signals2::connection mParcelMgrConnection;
bool mIsMaturityRatingChangingDuringTeleport;
U8 mMaturityRatingChange;
@@ -685,6 +687,7 @@ private:
void handleTeleportFinished();
void handleTeleportFailed();
+ static void onParcelReadyAfterTeleport();
static void onCapabilitiesReceivedAfterTeleport();
//--------------------------------------------------------------------
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 2ba2c6d8b5..2bb68dbbbe 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -122,6 +122,7 @@ public:
mUserNameFont(NULL),
mUserNameTextBox(NULL),
mTimeBoxTextBox(NULL),
+ mNeedsTimeBox(true),
mAvatarNameCacheConnection()
{}
@@ -643,8 +644,19 @@ public:
user_name->setReadOnlyColor(style_params.readonly_color());
user_name->setColor(style_params.color());
- if (chat.mFromName.empty()
- || mSourceType == CHAT_SOURCE_SYSTEM)
+ if (mSourceType == CHAT_SOURCE_TELEPORT
+ && chat.mChatStyle == CHAT_STYLE_TELEPORT_SEP)
+ {
+ mFrom = chat.mFromName;
+ mNeedsTimeBox = false;
+ user_name->setValue(mFrom);
+ updateMinUserNameWidth();
+ LLColor4 sep_color = LLUIColorTable::instance().getColor("ChatTeleportSeparatorColor");
+ setTransparentColor(sep_color);
+ mTimeBoxTextBox->setVisible(FALSE);
+ }
+ else if (chat.mFromName.empty()
+ || mSourceType == CHAT_SOURCE_SYSTEM)
{
mFrom = LLTrans::getString("SECOND_LIFE");
if(!chat.mFromName.empty() && (mFrom != chat.mFromName))
@@ -727,6 +739,8 @@ public:
break;
case CHAT_SOURCE_SYSTEM:
icon->setValue(LLSD("SL_Logo"));
+ case CHAT_SOURCE_TELEPORT:
+ icon->setValue(LLSD("Command_Destinations_Icon"));
break;
case CHAT_SOURCE_UNKNOWN:
icon->setValue(LLSD("Unknown_Icon"));
@@ -766,7 +780,7 @@ public:
S32 user_name_width = user_name_rect.getWidth();
S32 time_box_width = time_box->getRect().getWidth();
- if (!time_box->getVisible() && user_name_width > mMinUserNameWidth)
+ if (mNeedsTimeBox && !time_box->getVisible() && user_name_width > mMinUserNameWidth)
{
user_name_rect.mRight -= time_box_width;
user_name->reshape(user_name_rect.getWidth(), user_name_rect.getHeight());
@@ -968,6 +982,8 @@ protected:
LLTextBox* mUserNameTextBox;
LLTextBox* mTimeBoxTextBox;
+ bool mNeedsTimeBox;
+
private:
boost::signals2::connection mAvatarNameCacheConnection;
};
@@ -1202,6 +1218,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
}
bool message_from_log = chat.mChatStyle == CHAT_STYLE_HISTORY;
+ bool teleport_separator = chat.mSourceType == CHAT_SOURCE_TELEPORT;
// We graying out chat history by graying out messages that contains full date in a time string
if (message_from_log)
{
@@ -1222,14 +1239,14 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
LLStyle::Params timestamp_style(body_message_params);
// out of the timestamp
- if (args["show_time"].asBoolean())
+ if (args["show_time"].asBoolean() && !teleport_separator)
{
- if (!message_from_log)
- {
- LLColor4 timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor");
- timestamp_style.color(timestamp_color);
- timestamp_style.readonly_color(timestamp_color);
- }
+ if (!message_from_log)
+ {
+ LLColor4 timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor");
+ timestamp_style.color(timestamp_color);
+ timestamp_style.readonly_color(timestamp_color);
+ }
mEditor->appendText("[" + chat.mTimeStr + "] ", prependNewLineState, timestamp_style);
prependNewLineState = false;
}
@@ -1272,6 +1289,13 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
prependNewLineState, link_params);
prependNewLineState = false;
}
+ else if (teleport_separator)
+ {
+ std::string tp_text = LLTrans::getString("teleport_preamble_compact_chat");
+ mEditor->appendText(tp_text + " <nolink>" + chat.mFromName + "</nolink>",
+ prependNewLineState, body_message_params);
+ prependNewLineState = false;
+ }
else
{
mEditor->appendText("<nolink>" + chat.mFromName + "</nolink>" + delimiter,
@@ -1290,8 +1314,8 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
p.right_pad = mRightWidgetPad;
LLDate new_message_time = LLDate::now();
-
- if (mLastFromName == chat.mFromName
+ if (!teleport_separator
+ && mLastFromName == chat.mFromName
&& mLastFromID == chat.mFromID
&& mLastMessageTime.notNull()
&& (new_message_time.secondsSinceEpoch() - mLastMessageTime.secondsSinceEpoch()) < 60.0
@@ -1314,7 +1338,14 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
p.top_pad = 0;
else
p.top_pad = mTopHeaderPad;
- p.bottom_pad = mBottomHeaderPad;
+ if (teleport_separator)
+ {
+ p.bottom_pad = mBottomSeparatorPad;
+ }
+ else
+ {
+ p.bottom_pad = mBottomHeaderPad;
+ }
if (!view)
{
LL_WARNS() << "Failed to create header from " << mMessageHeaderFilename << ": can't append to history" << LL_ENDL;
@@ -1392,9 +1423,8 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
}
}
}
-
// usual messages showing
- else
+ else if(!teleport_separator)
{
std::string message = irc_me ? chat.mText.substr(3) : chat.mText;
@@ -1427,7 +1457,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
if (square_brackets)
{
message += "]";
- }
+ }
mEditor->appendText(message, prependNewLineState, body_message_params);
prependNewLineState = false;
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index d314b1477a..5679c3c325 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -474,6 +474,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
gAgent.setTeleportState( LLAgent::TELEPORT_ARRIVING );
gAgent.setTeleportMessage(
LLAgent::sTeleportProgressMessages["arriving"]);
+ gAgent.sheduleTeleportIM();
gTextureList.mForceResetTextureStats = TRUE;
gAgentCamera.resetView(TRUE, TRUE);
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index 034576d30c..92398857ba 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -851,6 +851,9 @@
name="ColorSwatchBorderColor"
value="0.45098 0.517647 0.607843 1"/>
<color
+ name="ChatTeleportSeparatorColor"
+ reference="Black" />
+ <color
name="ChatTimestampColor"
reference="White" />
<color
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index db9d3bfa83..c2b5286fc3 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -3759,6 +3759,9 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
<string name="unread_chat_multiple">
[SOURCES] have said something new
</string>
+ <string name="teleport_preamble_compact_chat">
+ You are now at
+ </string>
<string name="session_initialization_timed_out_error">
The session initialization is timed out
</string>