本文整理汇总了C++中LLWString::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ LLWString::empty方法的具体用法?C++ LLWString::empty怎么用?C++ LLWString::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLWString
的用法示例。
在下文中一共展示了LLWString::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addLabel
void LLHUDNameTag::addLabel(const std::string& label_utf8)
{
LLWString wstr = utf8string_to_wstring(label_utf8);
if (!wstr.empty())
{
LLWString seps(utf8str_to_wstring("\r\n"));
LLWString empty;
typedef boost::tokenizer<boost::char_separator<llwchar>, LLWString::const_iterator, LLWString > tokenizer;
boost::char_separator<llwchar> sep(seps.c_str(), empty.c_str(), boost::keep_empty_tokens);
tokenizer tokens(wstr, sep);
tokenizer::iterator iter = tokens.begin();
while (iter != tokens.end())
{
U32 line_length = 0;
do
{
S32 segment_length = mFontp->maxDrawableChars(iter->substr(line_length).c_str(),
HUD_TEXT_MAX_WIDTH, wstr.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE);
LLHUDTextSegment segment(iter->substr(line_length, segment_length), LLFontGL::NORMAL, mColor, mFontp);
mLabelSegments.push_back(segment);
line_length += segment_length;
}
while (line_length != iter->size());
++iter;
}
}
}
示例2: addEntryToList
bool LLAutoReplaceSettings::addEntryToList(LLWString keyword, LLWString replacement, std::string listName)
{
bool added = false;
if ( ! keyword.empty() && ! replacement.empty() )
{
bool isOneWord = true;
for (S32 character = 0; isOneWord && character < keyword.size(); character++ )
{
if ( ! LLWStringUtil::isPartOfWord(keyword[character]) )
{
LL_WARNS("AutoReplace") << "keyword '" << wstring_to_utf8str(keyword) << "' not a single word (len "<<keyword.size()<<" '"<<character<<"')" << LL_ENDL;
isOneWord = false;
}
}
if ( isOneWord )
{
bool listFound = false;
for( LLSD::array_iterator list = mLists.beginArray(), endLists = mLists.endArray();
! listFound && list != endLists;
list++
)
{
if ( listNameMatches(*list, listName) )
{
listFound = true;
(*list)[AUTOREPLACE_LIST_REPLACEMENTS][wstring_to_utf8str(keyword)]=wstring_to_utf8str(replacement);
}
}
if (listFound)
{
added = true;
}
else
{
LL_WARNS("AutoReplace") << "list '" << listName << "' not found" << LL_ENDL;
}
}
}
return added;
}
示例3: addLine
void LLFixedBuffer::addLine(const LLWString& line)
{
if (line.empty())
{
return;
}
removeExtraLines();
mLines.push_back(line);
mLineLengths.push_back((S32)line.length());
mAddTimes.push_back(mTimer.getElapsedTimeF32());
}
示例4: sendChat
// <dogmode>
void LLChatBar::sendChat( EChatType type )
{
if (mInputEditor)
{
LLWString text = mInputEditor->getConvertedText();
if (!text.empty())
{
// store sent line in history, duplicates will get filtered
if (mInputEditor) mInputEditor->updateHistory();
S32 channel = 0;
stripChannelNumber(text, &channel);
std::string utf8text = wstring_to_utf8str(text);//+" and read is "+llformat("%f",readChan)+" and undone is "+llformat("%d",undoneChan)+" but actualy channel is "+llformat("%d",channel);
// Try to trigger a gesture, if not chat to a script.
std::string utf8_revised_text;
if (0 == channel)
{
convert_roleplay_text(utf8text);
// discard returned "found" boolean
LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text);
}
else
{
utf8_revised_text = utf8text;
}
utf8_revised_text = utf8str_trim(utf8_revised_text);
EChatType nType(type == CHAT_TYPE_OOC ? CHAT_TYPE_NORMAL : type);
if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, nType))
{
// Chat with animation
#if SHY_MOD //Command handler
if(!SHCommandHandler::handleCommand(true, utf8_revised_text, gAgentID, (LLViewerObject*)gAgentAvatarp))//returns true if handled
#endif //shy_mod
sendChatFromViewer(utf8_revised_text, nType, TRUE);
}
}
}
childSetValue("Chat Editor", LLStringUtil::null);
gAgent.stopTyping();
// If the user wants to stop chatting on hitting return, lose focus
// and go out of chat mode.
if (gChatBar == this && gSavedSettings.getBOOL("CloseChatOnReturn"))
{
stopChat();
}
}
示例5: sendChat
void LLNearbyChatBar::sendChat( EChatType type )
{
if (mChatBox)
{
LLWString text = mChatBox->getConvertedText();
if (!text.empty())
{
// store sent line in history, duplicates will get filtered
mChatBox->updateHistory();
// Check if this is destined for another channel
S32 channel = 0;
stripChannelNumber(text, &channel);
std::string utf8text = wstring_to_utf8str(text);
// Try to trigger a gesture, if not chat to a script.
std::string utf8_revised_text;
if (0 == channel)
{
// discard returned "found" boolean
LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text);
}
else
{
utf8_revised_text = utf8text;
}
utf8_revised_text = utf8str_trim(utf8_revised_text);
type = processChatTypeTriggers(type, utf8_revised_text);
if (!utf8_revised_text.empty())
{
// Chat with animation
sendChatFromViewer(utf8_revised_text, type, TRUE);
}
}
mChatBox->setText(LLStringExplicit(""));
}
gAgent.stopTyping();
// If the user wants to stop chatting on hitting return, lose focus
// and go out of chat mode.
if (gSavedSettings.getBOOL("CloseChatOnReturn"))
{
stopChat();
}
}
示例6: sendChat
void LLChatBar::sendChat( EChatType type )
{
if (mInputEditor)
{
LLWString text = mInputEditor->getConvertedText();
if (!text.empty())
{
// store sent line in history, duplicates will get filtered
if (mInputEditor) mInputEditor->updateHistory();
// Check if this is destined for another channel
S32 channel = mChanCtrlEnabled ? (S32)(mChannelControl->get()) : 0;
stripChannelNumber(text, &channel);
std::string utf8text = wstring_to_utf8str(text);
// Try to trigger a gesture, if not chat to a script.
std::string utf8_revised_text;
if (0 == channel)
{
// discard returned "found" boolean
gGestureManager.triggerAndReviseString(utf8text, &utf8_revised_text);
}
else
{
utf8_revised_text = utf8text;
}
utf8_revised_text = utf8str_trim(utf8_revised_text);
if (!utf8_revised_text.empty())
{
// Chat with animation
sendChatFromViewer(utf8_revised_text, type, TRUE);
}
}
}
childSetValue("Chat Editor", LLStringUtil::null);
gAgent.stopTyping();
// If the user wants to stop chatting on hitting return, lose focus
// and go out of chat mode.
if (gChatBar == this && gSavedSettings.getBOOL("CloseChatOnReturn"))
{
stopChat();
}
}
示例7: sendMsg
void LLFloaterIMPanel::sendMsg()
{
if (!gAgent.isGodlike()
&& (mDialog == IM_NOTHING_SPECIAL)
&& mOtherParticipantUUID.isNull())
{
llinfos << "Cannot send IM to everyone unless you're a god." << llendl;
return;
}
if (mInputEditor)
{
LLWString text = mInputEditor->getConvertedText();
if(!text.empty())
{
// store sent line in history, duplicates will get filtered
if (mInputEditor) mInputEditor->updateHistory();
// 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 )
{
LLIMModel::sendMessage(utf8_text,
mSessionUUID,
mOtherParticipantUUID,
mDialog);
}
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);
}
// Don't need to actually send the typing stop message, the other
// client will infer it from receiving the message.
mTyping = FALSE;
mSentTypingState = TRUE;
}
示例8: addQueuedLines
void LLConsole::addQueuedLines()
{
for (line_queue_t::iterator iter = mLineQueue.begin();
iter != mLineQueue.end(); ++iter)
{
LineInfo& line_info = *iter;
LLWString wline = line_info.wline;
//F32 size = line_info.size;
LLColor4 color = line_info.color;
if (!wline.empty() && mFont != NULL)
{
// Wrap lines that are longer than the view is wide.
S32 offset = 0;
while( offset < (S32)wline.length() )
{
S32 skip_chars; // skip '\n'
// Figure out if a word-wrapped line fits here.
LLWString::size_type line_end = wline.find_first_of(llwchar('\n'), offset);
if (line_end != LLWString::npos)
{
skip_chars = 1; // skip '\n'
}
else
{
line_end = wline.size();
skip_chars = 0;
}
U32 drawable = mFont->maxDrawableChars(wline.c_str()+offset, (F32)mRect.getWidth(), line_end-offset, TRUE);
if (drawable != 0)
{
LLFixedBuffer::addLine(wline.substr(offset, drawable));
mAddTimes[mAddTimes.size()-1] = line_info.add_time;
}
else
{
// force a blank line
LLFixedBuffer::addLine(" ");
}
mColors.push_back(color);
offset += (drawable + skip_chars);
}
}
}
mLineQueue.clear();
}
示例9: sendMsg
void LLIMFloater::sendMsg()
{
if (!gAgent.isGodlike()
&& (mDialog == IM_NOTHING_SPECIAL)
&& mOtherParticipantUUID.isNull())
{
llinfos << "Cannot send IM to everyone unless you're a god." << llendl;
return;
}
if (mInputEditor)
{
LLWString text = mInputEditor->getConvertedText();
if(!text.empty())
{
// 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)
{
LLIMModel::sendMessage(utf8_text, mSessionID,
mOtherParticipantUUID,mDialog);
}
else
{
//queue up the message to send once the session is initialized
mQueuedMsgsForInit.append(utf8_text);
}
mInputEditor->setText(LLStringUtil::null);
updateMessages();
}
else if (gSavedSettings.getBOOL("CloseIMOnEmptyReturn"))
{
// Close if we're the child of a floater
closeFloater();
}
}
}
示例10: addLine
void LLHUDText::addLine(const std::string &text_utf8,
const LLColor4& color,
const LLFontGL::StyleFlags style,
const LLFontGL* font)
{
LLWString wline = utf8str_to_wstring(text_utf8);
if (!wline.empty())
{
// use default font for segment if custom font not specified
if (!font)
{
font = mFontp;
}
typedef boost::tokenizer<boost::char_separator<llwchar>, LLWString::const_iterator, LLWString > tokenizer;
LLWString seps(utf8str_to_wstring("\r\n"));
boost::char_separator<llwchar> sep(seps.c_str());
tokenizer tokens(wline, sep);
tokenizer::iterator iter = tokens.begin();
while (iter != tokens.end())
{
U32 line_length = 0;
do
{
F32 max_pixels = HUD_TEXT_MAX_WIDTH_NO_BUBBLE;
S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE);
LLHUDTextSegment segment(iter->substr(line_length, segment_length), style, color, font);
mTextSegments.push_back(segment);
line_length += segment_length;
}
while (line_length != iter->size());
++iter;
}
}
}
示例11: hud_render_text
void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
const LLFontGL &font,
const U8 style,
const LLFontGL::ShadowType shadow,
const F32 x_offset, const F32 y_offset,
const LLColor4& color,
const BOOL orthographic)
{
LLViewerCamera* camera = LLViewerCamera::getInstance();
// Do cheap plane culling
LLVector3 dir_vec = pos_agent - camera->getOrigin();
dir_vec /= dir_vec.magVec();
if (wstr.empty() || (!orthographic && dir_vec * camera->getAtAxis() <= 0.f))
{
return;
}
LLVector3 right_axis;
LLVector3 up_axis;
if (orthographic)
{
right_axis.setVec(0.f, -1.f / gViewerWindow->getWorldViewHeightScaled(), 0.f);
up_axis.setVec(0.f, 0.f, 1.f / gViewerWindow->getWorldViewHeightScaled());
}
else
{
camera->getPixelVectors(pos_agent, up_axis, right_axis);
}
LLCoordFrame render_frame = *camera;
LLQuaternion rot;
if (!orthographic)
{
rot = render_frame.getQuaternion();
rot = rot * LLQuaternion(-F_PI_BY_TWO, camera->getYAxis());
rot = rot * LLQuaternion(F_PI_BY_TWO, camera->getXAxis());
}
else
{
rot = LLQuaternion(-F_PI_BY_TWO, LLVector3(0.f, 0.f, 1.f));
rot = rot * LLQuaternion(-F_PI_BY_TWO, LLVector3(0.f, 1.f, 0.f));
}
F32 angle;
LLVector3 axis;
rot.getAngleAxis(&angle, axis);
LLVector3 render_pos = pos_agent + (floorf(x_offset) * right_axis) + (floorf(y_offset) * up_axis);
//get the render_pos in screen space
LLVector3 window_coordinates;
F32& winX = window_coordinates.mV[VX];
F32& winY = window_coordinates.mV[VY];
F32& winZ = window_coordinates.mV[VZ];
const LLRect& world_view_rect = gViewerWindow->getWorldViewRectRaw();
glProjectf(render_pos, gGLModelView, gGLProjection, world_view_rect, window_coordinates);
//fonts all render orthographically, set up projection``
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
LLUI::pushMatrix();
gl_state_for_2d(world_view_rect.getWidth(), world_view_rect.getHeight());
gViewerWindow->setup3DViewport();
winX -= world_view_rect.mLeft;
winY -= world_view_rect.mBottom;
LLUI::loadIdentity();
gGL.loadIdentity();
LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f));
F32 right_x;
font.render(wstr, 0, 0, 0, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x);
LLUI::popMatrix();
gGL.popMatrix();
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
gGL.matrixMode(LLRender::MM_MODELVIEW);
}
示例12: onSendMsg
// Singu Note: LLFloaterIMSession::sendMsg
void LLFloaterIMPanel::onSendMsg()
{
if (!gAgent.isGodlike()
&& (mSessionType == P2P_SESSION)
&& mOtherParticipantUUID.isNull())
{
llinfos << "Cannot send IM to everyone unless you're a god." << llendl;
return;
}
if (mInputEditor)
{
LLWString text = mInputEditor->getConvertedText();
if(!text.empty())
{
// store sent line in history, duplicates will get filtered
if (mInputEditor) mInputEditor->updateHistory();
// Truncate and convert to UTF8 for transport
std::string utf8_text = wstring_to_utf8str(text);
bool action = convert_roleplay_text(utf8_text);
if (!action && mRPMode)
utf8_text = "((" + utf8_text + "))";
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0)
if ( (RlvActions::hasBehaviour(RLV_BHVR_SENDIM)) || (RlvActions::hasBehaviour(RLV_BHVR_SENDIMTO)) )
{
bool fRlvFilter = false;
switch (mSessionType)
{
case P2P_SESSION: // One-on-one IM
fRlvFilter = !RlvActions::canSendIM(mOtherParticipantUUID);
break;
case GROUP_SESSION: // Group chat
fRlvFilter = !RlvActions::canSendIM(mSessionUUID);
break;
case ADHOC_SESSION: // Conference chat: allow if all participants can be sent an IM
{
if (!mSpeakers)
{
fRlvFilter = true;
break;
}
LLSpeakerMgr::speaker_list_t speakers;
mSpeakers->getSpeakerList(&speakers, TRUE);
for (LLSpeakerMgr::speaker_list_t::const_iterator itSpeaker = speakers.begin();
itSpeaker != speakers.end(); ++itSpeaker)
{
const LLSpeaker* pSpeaker = *itSpeaker;
if ( (gAgentID != pSpeaker->mID) && (!RlvActions::canSendIM(pSpeaker->mID)) )
{
fRlvFilter = true;
break;
}
}
}
break;
default:
fRlvFilter = true;
break;
}
if (fRlvFilter)
{
utf8_text = RlvStrings::getString(RLV_STRING_BLOCKED_SENDIM);
}
}
// [/RLVa:KB]
if ( mSessionInitialized )
{
// 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_text.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(utf8_text[pos + next_split]) != 0x20 // space
&& U8(utf8_text[pos + next_split]) != 0x21 // !
&& U8(utf8_text[pos + next_split]) != 0x2C // ,
&& U8(utf8_text[pos + next_split]) != 0x2E // .
&& U8(utf8_text[pos + next_split]) != 0x3F // ?
&& next_split > 0)
{
--next_split;
}
if (next_split == 0)
{
//.........这里部分代码省略.........
示例13: render
S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style,
ShadowType shadow, S32 max_chars, S32 max_pixels, F32* right_x, BOOL use_embedded, BOOL use_ellipses) const
{
LLFastTimer _(FTM_RENDER_FONTS);
if(!sDisplayFont) //do not display texts
{
return wstr.length() ;
}
if (wstr.empty() || !max_pixels)
{
return 0;
}
if (max_chars == -1)
max_chars = S32_MAX;
const S32 max_index = llmin(llmax(max_chars, begin_offset + max_chars), S32(wstr.length()));
if (max_index <= 0 || begin_offset >= max_index || max_pixels <= 0)
return 0;
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
S32 scaled_max_pixels = max_pixels == S32_MAX ? S32_MAX : llceil((F32)max_pixels * sScaleX);
// Strip off any style bits that are already accounted for by the font.
style = style & (~getFontDesc().getStyle());
F32 drop_shadow_strength = 0.f;
if (shadow != NO_SHADOW)
{
F32 luminance;
color.calcHSL(NULL, NULL, &luminance);
drop_shadow_strength = clamp_rescale(luminance, 0.35f, 0.6f, 0.f, 1.f);
if (luminance < 0.35f)
{
shadow = NO_SHADOW;
}
}
gGL.pushUIMatrix();
gGL.loadUIIdentity();
LLVector2 origin(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY));
// Depth translation, so that floating text appears 'in-world'
// and is correctly occluded.
gGL.translatef(0.f,0.f,sCurDepth);
S32 chars_drawn = 0;
S32 i;
S32 length = max_index - begin_offset;
F32 cur_x, cur_y, cur_render_x, cur_render_y;
// Not guaranteed to be set correctly
gGL.setSceneBlendType(LLRender::BT_ALPHA);
cur_x = ((F32)x * sScaleX) + origin.mV[VX];
cur_y = ((F32)y * sScaleY) + origin.mV[VY];
// Offset y by vertical alignment.
// use unscaled font metrics here
switch (valign)
{
case TOP:
cur_y -= llceil(mFontFreetype->getAscenderHeight());
break;
case BOTTOM:
cur_y += llceil(mFontFreetype->getDescenderHeight());
break;
case VCENTER:
cur_y -= llceil((llceil(mFontFreetype->getAscenderHeight()) - llceil(mFontFreetype->getDescenderHeight())) / 2.f);
break;
case BASELINE:
// Baseline, do nothing.
break;
default:
break;
}
switch (halign)
{
case LEFT:
break;
case RIGHT:
cur_x -= llmin(scaled_max_pixels, ll_round(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX));
break;
case HCENTER:
cur_x -= llmin(scaled_max_pixels, ll_round(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)) / 2;
break;
default:
break;
}
cur_render_y = cur_y;
cur_render_x = cur_x;
//.........这里部分代码省略.........
示例14: draw
//.........这里部分代码省略.........
S32 center_x = getLocalRect().getCenterX();
S32 center_y = getLocalRect().getCenterY();
//FUGLY HACK FOR "DEPRESSED" BUTTONS
if (pressed)
{
center_y--;
center_x++;
}
center_y += (mImageOverlayBottomPad - mImageOverlayTopPad);
// fade out overlay images on disabled buttons
LLColor4 overlay_color = mImageOverlayColor.get();
if (!enabled)
{
overlay_color.mV[VALPHA] = 0.5f;
}
overlay_color.mV[VALPHA] *= alpha;
switch(mImageOverlayAlignment)
{
case LLFontGL::LEFT:
text_left += overlay_width + mImgOverlayLabelSpace;
mImageOverlay->draw(
mLeftHPad,
center_y - (overlay_height / 2),
overlay_width,
overlay_height,
overlay_color);
break;
case LLFontGL::HCENTER:
mImageOverlay->draw(
center_x - (overlay_width / 2),
center_y - (overlay_height / 2),
overlay_width,
overlay_height,
overlay_color);
break;
case LLFontGL::RIGHT:
text_right -= overlay_width + mImgOverlayLabelSpace;
mImageOverlay->draw(
getRect().getWidth() - mRightHPad - overlay_width,
center_y - (overlay_height / 2),
overlay_width,
overlay_height,
overlay_color);
break;
default:
// draw nothing
break;
}
}
// Draw label
if( !label.empty() )
{
LLWStringUtil::trim(label);
S32 x;
switch( mHAlign )
{
case LLFontGL::RIGHT:
x = text_right;
break;
case LLFontGL::HCENTER:
x = text_left + (text_width / 2);
break;
case LLFontGL::LEFT:
default:
x = text_left;
break;
}
S32 y_offset = 2 + (getRect().getHeight() - 20)/2;
if (pressed)
{
y_offset--;
x++;
}
// *NOTE: mantipov: before mUseEllipses is implemented in EXT-279 U32_MAX has been passed as
// max_chars.
// LLFontGL::render expects S32 max_chars variable but process in a separate way -1 value.
// Due to U32_MAX is equal to S32 -1 value I have rest this value for non-ellipses mode.
// Not sure if it is really needed. Probably S32_MAX should be always passed as max_chars.
mLastDrawCharsCount = mGLFont->render(label, 0,
(F32)x,
(F32)(mBottomVPad + y_offset),
label_color % alpha,
mHAlign, LLFontGL::BOTTOM,
LLFontGL::NORMAL,
mDropShadowedText ? LLFontGL::DROP_SHADOW_SOFT : LLFontGL::NO_SHADOW,
S32_MAX, text_width,
NULL, mUseEllipses);
}
LLUICtrl::draw();
}
示例15: sendChat
void LLChatBar::sendChat( EChatType type )
{
if (mInputEditor)
{
LLWString text = mInputEditor->getConvertedText();
if (!text.empty())
{
// store sent line in history, duplicates will get filtered
if (mInputEditor) mInputEditor->updateHistory();
// Check if this is destined for another channel
S32 channel = mChanCtrlEnabled ? (S32)(mChannelControl->get()) : 0;
stripChannelNumber(text, &channel);
std::string utf8text = wstring_to_utf8str(text);
// Try to trigger a gesture, if not chat to a script.
std::string utf8_revised_text;
if (0 == channel)
{
if (gSavedSettings.getBOOL("AutoCloseOOC"))
{
// Try to find any unclosed OOC chat (i.e. an opening
// double parenthesis without a matching closing double
// parenthesis.
if (utf8text.find("((") != -1 && utf8text.find("))") == -1)
{
if (utf8text.at(utf8text.length() - 1) == ')')
{
// cosmetic: add a space first to avoid a closing triple parenthesis
utf8text += " ";
}
// add the missing closing double parenthesis.
utf8text += "))";
}
}
// Convert MU*s style poses into IRC emotes here.
if (gSavedSettings.getBOOL("AllowMUpose") && utf8text.find(":") == 0 && utf8text.length() > 3)
{
if (utf8text.find(":'") == 0)
{
utf8text.replace(0, 1, "/me");
}
else if (isalpha(utf8text.at(1))) // Do not prevent smileys and such.
{
utf8text.replace(0, 1, "/me ");
}
}
// discard returned "found" boolean
gGestureManager.triggerAndReviseString(utf8text, &utf8_revised_text);
}
else
{
utf8_revised_text = utf8text;
}
utf8_revised_text = utf8str_trim(utf8_revised_text);
if (!utf8_revised_text.empty())
if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, type))
{
// Chat with animation
sendChatFromViewer(utf8_revised_text, type, TRUE);
}
}
}
childSetValue("Chat Editor", LLStringUtil::null);
gAgent.stopTyping();
// If the user wants to stop chatting on hitting return, lose focus
// and go out of chat mode.
if (gChatBar == this && gSavedSettings.getBOOL("CloseChatOnReturn"))
{
stopChat();
}
}