diff options
Diffstat (limited to 'indra/newview/llimfloater.cpp')
-rw-r--r-- | indra/newview/llimfloater.cpp | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 85863ed85b..54fc6f02fb 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -115,7 +115,7 @@ void LLIMFloater::onClose(bool app_quitting) /* static */ void LLIMFloater::newIMCallback(const LLSD& data){ - if (data["num_unread"].asInteger() > 0) + if (data["num_unread"].asInteger() > 0 || data["from_id"].asUUID().isNull()) { LLUUID session_id = data["session_id"].asUUID(); @@ -235,7 +235,7 @@ BOOL LLIMFloater::postBuild() std::string session_name(LLIMModel::instance().getName(mSessionID)); - mInputEditor->setLabel(mInputEditor->getLabel() + " " + session_name); + mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + session_name); LLStringUtil::toUpper(session_name); setTitle(session_name); @@ -363,7 +363,7 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) void LLIMFloater::getAllowedRect(LLRect& rect) { - rect = gViewerWindow->getWorldViewRect(); + rect = gViewerWindow->getWorldViewRectRaw(); } void LLIMFloater::setDocked(bool docked, bool pop_on_undock) @@ -479,11 +479,29 @@ void LLIMFloater::updateMessages() LLStyle::Params style_params; style_params.color(chat_color); - LLChat chat(message); + LLChat chat; chat.mFromID = from_id; chat.mFromName = from; - mChatHistory->appendWidgetMessage(chat, style_params); + //Handle IRC styled /me messages. + std::string prefix = message.substr(0, 4); + if (prefix == "/me " || prefix == "/me'") + { + if (from.size() > 0) + { + style_params.font.style = "ITALIC"; + chat.mText = from + " "; + mChatHistory->appendWidgetMessage(chat, style_params); + } + message = message.substr(3); + style_params.font.style = "UNDERLINE"; + mChatHistory->appendText(message, FALSE, style_params); + } + else + { + chat.mText = message; + mChatHistory->appendWidgetMessage(chat, style_params); + } mLastMessageIndex = msg["index"].asInteger(); } @@ -498,7 +516,8 @@ void LLIMFloater::onInputEditorFocusReceived( LLFocusableElement* caller, void* // Allow enabling the LLIMFloater input editor only if session can accept text LLIMModel::LLIMSession* im_session = LLIMModel::instance().findIMSession(self->mSessionID); - if( im_session && im_session->mTextIMPossible ) + //TODO: While disabled lllineeditor can receive focus we need to check if it is enabled (EK) + if( im_session && im_session->mTextIMPossible && self->mInputEditor->getEnabled()) { //in disconnected state IM input editor should be disabled self->mInputEditor->setEnabled(!gDisconnected); @@ -588,6 +607,32 @@ void LLIMFloater::processIMTyping(const LLIMInfo* im_info, BOOL typing) } } +void LLIMFloater::processAgentListUpdates(const LLSD& body) +{ + if ( !body.isMap() ) return; + + if ( body.has("agent_updates") && body["agent_updates"].isMap() ) + { + LLSD agent_data = body["agent_updates"].get(gAgentID.asString()); + if (agent_data.isMap() && agent_data.has("info")) + { + LLSD agent_info = agent_data["info"]; + + if (agent_info.has("mutes")) + { + BOOL moderator_muted_text = agent_info["mutes"]["text"].asBoolean(); + mInputEditor->setEnabled(!moderator_muted_text); + std::string label; + if (moderator_muted_text) + label = LLTrans::getString("IM_muted_text_label"); + else + label = LLTrans::getString("IM_to_label") + " " + LLIMModel::instance().getName(mSessionID); + mInputEditor->setLabel(label); + } + } + } +} + void LLIMFloater::processSessionUpdate(const LLSD& session_update) { // *TODO : verify following code when moderated mode will be implemented |