Issue 14 - unlimited message lengths resolved.
This commit is contained in:
@@ -91,6 +91,7 @@ void toggleChatHistory(void* user_data);
|
||||
// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.2a
|
||||
void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel);
|
||||
// [/RLVa:KB]
|
||||
void really_send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel);
|
||||
|
||||
|
||||
class LLChatBarGestureObserver : public LLGestureManagerObserver
|
||||
@@ -160,7 +161,6 @@ BOOL LLChatBar::postBuild()
|
||||
mInputEditor->setPassDelete(TRUE);
|
||||
mInputEditor->setReplaceNewlinesWithSpaces(FALSE);
|
||||
|
||||
mInputEditor->setMaxTextLength(DB_CHAT_MSG_STR_LEN);
|
||||
mInputEditor->setEnableLineHistory(TRUE);
|
||||
}
|
||||
|
||||
@@ -662,10 +662,6 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL
|
||||
S32 channel = 0;
|
||||
LLWString out_text = stripChannelNumber(wtext, &channel);
|
||||
std::string utf8_out_text = wstring_to_utf8str(out_text);
|
||||
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);
|
||||
@@ -774,6 +770,60 @@ void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channe
|
||||
}
|
||||
// [/RLVa:KB]
|
||||
|
||||
// Split messages that are too long, same code like in llimpanel.cpp
|
||||
U32 split = MAX_MSG_BUF_SIZE - 1;
|
||||
U32 pos = 0;
|
||||
U32 total = utf8_out_text.length();
|
||||
|
||||
// Don't break null messages
|
||||
if (total == 0)
|
||||
{
|
||||
really_send_chat_from_viewer(utf8_out_text, type, channel);
|
||||
}
|
||||
|
||||
while (pos < total)
|
||||
{
|
||||
U32 next_split = split;
|
||||
|
||||
if (pos + next_split > total)
|
||||
{
|
||||
next_split = total - pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
// don't split utf-8 bytes
|
||||
while (U8(utf8_out_text[pos + next_split]) != 0x20 // space
|
||||
&& U8(utf8_out_text[pos + next_split]) != 0x21 // !
|
||||
&& U8(utf8_out_text[pos + next_split]) != 0x2C // ,
|
||||
&& U8(utf8_out_text[pos + next_split]) != 0x2E // .
|
||||
&& U8(utf8_out_text[pos + next_split]) != 0x3F // ?
|
||||
&& next_split > 0)
|
||||
{
|
||||
--next_split;
|
||||
}
|
||||
|
||||
if (next_split == 0)
|
||||
{
|
||||
next_split = split;
|
||||
LL_WARNS("Splitting") << "utf-8 couldn't be split correctly" << LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
++next_split;
|
||||
}
|
||||
}
|
||||
|
||||
std::string send = utf8_out_text.substr(pos, next_split);
|
||||
pos += next_split;
|
||||
|
||||
really_send_chat_from_viewer(send, type, channel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This should do nothing other than send chat, with no other processing.
|
||||
void really_send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel)
|
||||
{
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
// <edit>
|
||||
if(channel >= 0)
|
||||
|
||||
@@ -1236,7 +1236,6 @@ void LLFloaterIMPanel::init(const std::string& session_label)
|
||||
// [/Ansariel: Display name support]
|
||||
|
||||
|
||||
mInputEditor->setMaxTextLength(DB_IM_MSG_STR_LEN);
|
||||
// enable line history support for instant message bar
|
||||
mInputEditor->setEnableLineHistory(TRUE);
|
||||
|
||||
@@ -2192,8 +2191,6 @@ void LLFloaterIMPanel::sendMsg()
|
||||
}
|
||||
}
|
||||
|
||||
utf8text = utf8str_truncate(utf8text, MAX_MSG_BUF_SIZE - 1);
|
||||
|
||||
std::string prefix = utf8text.substr(0, 4);
|
||||
if (prefix != "/me " && prefix != "/me'")
|
||||
if (mRPMode) utf8text = "[[" + utf8text + "]]";
|
||||
@@ -2236,10 +2233,52 @@ void LLFloaterIMPanel::sendMsg()
|
||||
|
||||
if ( mSessionInitialized )
|
||||
{
|
||||
deliver_message(utf8text,
|
||||
mSessionUUID,
|
||||
mOtherParticipantUUID,
|
||||
mDialog);
|
||||
// Split messages that are too long, same code like in llimpanel.cpp
|
||||
U32 split = MAX_MSG_BUF_SIZE - 1;
|
||||
U32 pos = 0;
|
||||
U32 total = utf8text.length();
|
||||
|
||||
while (pos < total)
|
||||
{
|
||||
U32 next_split = split;
|
||||
|
||||
if (pos + next_split > total)
|
||||
{
|
||||
next_split = total - pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
// don't split utf-8 bytes
|
||||
while (U8(utf8text[pos + next_split]) != 0x20 // space
|
||||
&& U8(utf8text[pos + next_split]) != 0x21 // !
|
||||
&& U8(utf8text[pos + next_split]) != 0x2C // ,
|
||||
&& U8(utf8text[pos + next_split]) != 0x2E // .
|
||||
&& U8(utf8text[pos + next_split]) != 0x3F // ?
|
||||
&& next_split > 0)
|
||||
{
|
||||
--next_split;
|
||||
}
|
||||
|
||||
if (next_split == 0)
|
||||
{
|
||||
next_split = split;
|
||||
LL_WARNS("Splitting") << "utf-8 couldn't be split correctly" << LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
++next_split;
|
||||
}
|
||||
}
|
||||
|
||||
std::string send = utf8text.substr(pos, next_split);
|
||||
pos += next_split;
|
||||
LL_WARNS("Splitting") << "Pos: " << pos << " next_split: " << next_split << LL_ENDL;
|
||||
|
||||
deliver_message(send,
|
||||
mSessionUUID,
|
||||
mOtherParticipantUUID,
|
||||
mDialog);
|
||||
}
|
||||
|
||||
// local echo
|
||||
if((mDialog == IM_NOTHING_SPECIAL) &&
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom="0"
|
||||
enabled="true" follows="left|right|bottom" font="SansSerif"
|
||||
handle_edit_keys_directly="false" height="20" label="Click here to chat."
|
||||
left="0" max_length="254" mouse_opaque="true" name="Chat Editor"
|
||||
left="0" max_length="2147483647" mouse_opaque="true" name="Chat Editor"
|
||||
right="-70" select_all_on_focus_received="false" select_on_focus="false"
|
||||
tab_group="1" spell_check="true" />
|
||||
<flyout_button bottom="0" follows="right|bottom" height="20" label="Say" left="-65"
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
text_readonly_color="ChatHistoryTextColor" width="487" word_wrap="true" />
|
||||
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom="7"
|
||||
follows="left|right|bottom" font="SansSerif" height="20"
|
||||
label="Click here to instant message" left="5" max_length="1022"
|
||||
label="Click here to instant message" left="5" max_length="2147483647"
|
||||
mouse_opaque="true" name="chat_editor" select_all_on_focus_received="false"
|
||||
select_on_focus="false" tab_group="1" width="423" spell_check="true" />
|
||||
<button bottom="7" follows="right|bottom" font="SansSerif" halign="center" height="20"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom="-23"
|
||||
follows="left|right|bottom" font="SansSerif"
|
||||
handle_edit_keys_directly="false" height="20" label="Click here to chat."
|
||||
left="107" max_length="254" name="Chat Editor"
|
||||
left="107" max_length="2147483647" name="Chat Editor"
|
||||
select_all_on_focus_received="false" select_on_focus="false" tab_group="1"
|
||||
tool_tip="Press Enter to say, Ctrl-Enter to shout." width="105" spell_check="true" />
|
||||
<flyout_button bottom="-23" follows="right|bottom" height="20" label="Say" left_delta="110"
|
||||
|
||||
Reference in New Issue
Block a user