From b9b4a4d9347053a3834ca2928063136948f09d1d Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Wed, 13 Aug 2008 19:37:05 +0000 Subject: QAR-782 Merge featurettes batch #2 merge featurettes-6-merge-2 -> release dataserver-is-deprecated --- indra/newview/llimpanel.cpp | 87 ++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 41 deletions(-) (limited to 'indra/newview/llimpanel.cpp') diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 328cb85c1f..ca5dd7be36 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -1238,6 +1238,7 @@ BOOL LLFloaterIMPanel::postBuild() mInputEditor->setCallbackUserData(this); mInputEditor->setCommitOnFocusLost( FALSE ); mInputEditor->setRevertOnEsc( FALSE ); + mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); childSetAction("profile_callee_btn", onClickProfile, this); childSetAction("group_info_btn", onClickGroupInfo, this); @@ -1925,8 +1926,6 @@ void deliver_message(const std::string& utf8_text, void LLFloaterIMPanel::sendMsg() { - LLWString text = mInputEditor->getWText(); - LLWStringUtil::trim(text); if (!gAgent.isGodlike() && (mDialog == IM_NOTHING_SPECIAL) && mOtherParticipantUUID.isNull()) @@ -1934,57 +1933,63 @@ void LLFloaterIMPanel::sendMsg() llinfos << "Cannot send IM to everyone unless you're a god." << llendl; return; } - if(text.length() > 0) - { - // Truncate and convert to UTF8 for transport - std::string utf8_text = wstring_to_utf8str(text); - utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); - if ( mSessionInitialized ) + if (mInputEditor) + { + LLWString text = mInputEditor->getConvertedText(); + if(!text.empty()) { - deliver_message(utf8_text, - mSessionUUID, - mOtherParticipantUUID, - mDialog); - - // local echo - if((mDialog == IM_NOTHING_SPECIAL) && - (mOtherParticipantUUID.notNull())) + // Truncate and convert to UTF8 for transport + std::string utf8_text = wstring_to_utf8str(text); + utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); + + if ( mSessionInitialized ) { - std::string history_echo; - gAgent.buildFullname(history_echo); - - // Look for IRC-style emotes here. - std::string prefix = utf8_text.substr(0, 4); - if (prefix == "/me " || prefix == "/me'") + deliver_message(utf8_text, + mSessionUUID, + mOtherParticipantUUID, + mDialog); + + // local echo + if((mDialog == IM_NOTHING_SPECIAL) && + (mOtherParticipantUUID.notNull())) { - utf8_text.replace(0,3,""); - } - else - { - history_echo += ": "; - } - history_echo += utf8_text; + std::string history_echo; + gAgent.buildFullname(history_echo); - BOOL other_was_typing = mOtherTyping; + // Look for IRC-style emotes here. + std::string prefix = utf8_text.substr(0, 4); + if (prefix == "/me " || prefix == "/me'") + { + utf8_text.replace(0,3,""); + } + else + { + history_echo += ": "; + } + history_echo += utf8_text; - addHistoryLine(history_echo, gSavedSettings.getColor("IMChatColor"), true, gAgent.getID()); + BOOL other_was_typing = mOtherTyping; - if (other_was_typing) - { - addTypingIndicator(mOtherTypingName); - } + addHistoryLine(history_echo, gSavedSettings.getColor("IMChatColor"), true, gAgent.getID()); + if (other_was_typing) + { + addTypingIndicator(mOtherTypingName); + } + + } + } + else + { + //queue up the message to send once the session is + //initialized + mQueuedMsgsForInit.append(utf8_text); } - } - else - { - //queue up the message to send once the session is - //initialized - mQueuedMsgsForInit.append(utf8_text); } LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT); + } mInputEditor->setText(LLStringUtil::null); -- cgit v1.2.3