From 1c28af54addf5673f06cb2e992ccbe1173a0509b Mon Sep 17 00:00:00 2001 From: Mm Alder Date: Sun, 3 Jan 2010 15:00:06 -0500 Subject: SNOW-376 Clean up handling of the maximum length of chat messages --- linden/indra/newview/llchatbar.cpp | 8 ++++++-- linden/indra/newview/llimpanel.cpp | 2 +- linden/indra/newview/llvoavatar.cpp | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/llchatbar.cpp b/linden/indra/newview/llchatbar.cpp index 44d1ad1..1146c44 100644 --- a/linden/indra/newview/llchatbar.cpp +++ b/linden/indra/newview/llchatbar.cpp @@ -154,7 +154,7 @@ BOOL LLChatBar::postBuild() mInputEditor->setPassDelete(TRUE); mInputEditor->setReplaceNewlinesWithSpaces(FALSE); - mInputEditor->setMaxTextLength(1023); + mInputEditor->setMaxTextLength(DB_CHAT_MSG_STR_LEN); mInputEditor->setEnableLineHistory(TRUE); } @@ -624,8 +624,12 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL LLWString out_text = stripChannelNumber(wtext, &channel); std::string utf8_out_text = wstring_to_utf8str(out_text); - std::string utf8_text = wstring_to_utf8str(wtext); + if (!utf8_out_text.empty()) + { + utf8_out_text = utf8str_truncate(utf8_out_text, MAX_MSG_STR_LEN); + } + std::string utf8_text = wstring_to_utf8str(wtext); utf8_text = utf8str_trim(utf8_text); if (!utf8_text.empty()) { diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp index a5950ce..326694a 100644 --- a/linden/indra/newview/llimpanel.cpp +++ b/linden/indra/newview/llimpanel.cpp @@ -1197,7 +1197,7 @@ void LLFloaterIMPanel::init(const std::string& session_label) setTitle(mSessionLabel); - mInputEditor->setMaxTextLength(1023); + mInputEditor->setMaxTextLength(DB_IM_MSG_STR_LEN); // enable line history support for instant message bar mInputEditor->setEnableLineHistory(TRUE); diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index 7e1c6ca..afee0a1 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp @@ -169,7 +169,7 @@ const F32 TIME_BEFORE_MESH_CLEANUP = 5.f; // seconds const S32 AVATAR_RELEASE_THRESHOLD = 10; // number of avatar instances before releasing memory const F32 FOOT_GROUND_COLLISION_TOLERANCE = 0.25f; const F32 AVATAR_LOD_TWEAK_RANGE = 0.7f; -const S32 MAX_BUBBLE_CHAT_LENGTH = 1023; +const S32 MAX_BUBBLE_CHAT_LENGTH = DB_CHAT_MSG_STR_LEN; const S32 MAX_BUBBLE_CHAT_UTTERANCES = 12; const F32 CHAT_FADE_TIME = 8.0; const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f; -- cgit v1.1