summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2009-11-17 16:07:48 -0800
committerJames Cook <james@lindenlab.com>2009-11-17 16:07:48 -0800
commit15cbc0abd89d97ab06ed8f0c2a4bb2245e75535c (patch)
tree5ccf97ad27df2def606db57de9a96cb07ec70eb6
parent6d6ee6af54cb1c1e1a73ae5697b5d9865e9dac42 (diff)
EXT-2403 Object name, description now forced to be ASCII characters only
Also fixes EXT-172, EXT-2399. Semantics now are: Object name, object desc, parcel name, region name, inventory item name all are ASCII only. Parcel desc allows arbitrary Unicode chars. Group names force ASCII only. Reviewed with Leyla
-rw-r--r--indra/llui/lllineeditor.cpp27
-rw-r--r--indra/llui/lllineeditor.h4
-rw-r--r--indra/newview/llfloatergodtools.cpp2
-rw-r--r--indra/newview/llfloaterland.cpp7
-rw-r--r--indra/newview/llfloaternamedesc.cpp4
-rw-r--r--indra/newview/llfloaterproperties.cpp4
-rw-r--r--indra/newview/llfolderview.cpp2
-rw-r--r--indra/newview/llpanelgroupgeneral.cpp1
-rw-r--r--indra/newview/llpanellogin.cpp4
-rw-r--r--indra/newview/llpanelpermissions.cpp4
-rw-r--r--indra/newview/llpreviewanim.cpp2
-rw-r--r--indra/newview/llpreviewgesture.cpp2
-rw-r--r--indra/newview/llpreviewnotecard.cpp2
-rw-r--r--indra/newview/llpreviewscript.cpp2
-rw-r--r--indra/newview/llpreviewsound.cpp2
-rw-r--r--indra/newview/llpreviewtexture.cpp2
-rw-r--r--indra/newview/llsidepaneliteminfo.cpp4
-rw-r--r--indra/newview/llsidepaneltaskinfo.cpp4
-rw-r--r--indra/newview/skins/default/xui/en/floater_test_line_editor.xml13
-rw-r--r--indra/newview/skins/default/xui/en/floater_tools.xml8
20 files changed, 59 insertions, 41 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 75905d0927..c2f91ff7e0 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -84,8 +84,8 @@ void LLLineEditor::PrevalidateNamedFuncs::declareValues()
declare("non_negative_s32", LLLineEditor::prevalidateNonNegativeS32);
declare("alpha_num", LLLineEditor::prevalidateAlphaNum);
declare("alpha_num_space", LLLineEditor::prevalidateAlphaNumSpace);
- declare("printable_not_pipe", LLLineEditor::prevalidatePrintableNotPipe);
- declare("printable_no_space", LLLineEditor::prevalidatePrintableNoSpace);
+ declare("ascii_printable_no_pipe", LLLineEditor::prevalidateASCIIPrintableNoPipe);
+ declare("ascii_printable_no_space", LLLineEditor::prevalidateASCIIPrintableNoSpace);
}
LLLineEditor::Params::Params()
@@ -2186,20 +2186,28 @@ BOOL LLLineEditor::prevalidateAlphaNumSpace(const LLWString &str)
return rv;
}
+// Used for most names of things stored on the server, due to old file-formats
+// that used the pipe (|) for multiline text storage. Examples include
+// inventory item names, parcel names, object names, etc.
// static
-BOOL LLLineEditor::prevalidatePrintableNotPipe(const LLWString &str)
+BOOL LLLineEditor::prevalidateASCIIPrintableNoPipe(const LLWString &str)
{
BOOL rv = TRUE;
S32 len = str.length();
if(len == 0) return rv;
while(len--)
{
- if('|' == str[len])
+ llwchar wc = str[len];
+ if (wc < 0x20
+ || wc > 0x7f
+ || wc == '|')
{
rv = FALSE;
break;
}
- if(!((' ' == str[len]) || LLStringOps::isAlnum((char)str[len]) || LLStringOps::isPunct((char)str[len])))
+ if(!(wc == ' '
+ || LLStringOps::isAlnum((char)wc)
+ || LLStringOps::isPunct((char)wc) ) )
{
rv = FALSE;
break;
@@ -2209,15 +2217,19 @@ BOOL LLLineEditor::prevalidatePrintableNotPipe(const LLWString &str)
}
+// Used for avatar names
// static
-BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str)
+BOOL LLLineEditor::prevalidateASCIIPrintableNoSpace(const LLWString &str)
{
BOOL rv = TRUE;
S32 len = str.length();
if(len == 0) return rv;
while(len--)
{
- if(LLStringOps::isSpace(str[len]))
+ llwchar wc = str[len];
+ if (wc < 0x20
+ || wc > 0x7f
+ || LLStringOps::isSpace(wc))
{
rv = FALSE;
break;
@@ -2232,6 +2244,7 @@ BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str)
return rv;
}
+
// static
BOOL LLLineEditor::prevalidateASCII(const LLWString &str)
{
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index d3daa941cf..4474963b1a 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -235,8 +235,8 @@ public:
static BOOL prevalidateNonNegativeS32(const LLWString &str);
static BOOL prevalidateAlphaNum(const LLWString &str );
static BOOL prevalidateAlphaNumSpace(const LLWString &str );
- static BOOL prevalidatePrintableNotPipe(const LLWString &str);
- static BOOL prevalidatePrintableNoSpace(const LLWString &str);
+ static BOOL prevalidateASCIIPrintableNoPipe(const LLWString &str);
+ static BOOL prevalidateASCIIPrintableNoSpace(const LLWString &str);
static BOOL prevalidateASCII(const LLWString &str);
static BOOL postvalidateFloat(const std::string &str);
diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp
index 886f5ec924..cd3432190b 100644
--- a/indra/newview/llfloatergodtools.cpp
+++ b/indra/newview/llfloatergodtools.cpp
@@ -415,7 +415,7 @@ LLPanelRegionTools::LLPanelRegionTools()
BOOL LLPanelRegionTools::postBuild()
{
getChild<LLLineEditor>("region name")->setKeystrokeCallback(onChangeSimName, this);
- childSetPrevalidate("region name", &LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("region name", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
childSetPrevalidate("estate", &LLLineEditor::prevalidatePositiveS32);
childSetPrevalidate("parentestate", &LLLineEditor::prevalidatePositiveS32);
childDisable("parentestate");
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 015a947d91..22d6098d5b 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -347,13 +347,14 @@ BOOL LLPanelLandGeneral::postBuild()
{
mEditName = getChild<LLLineEditor>("Name");
mEditName->setCommitCallback(onCommitAny, this);
- childSetPrevalidate("Name", LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("Name", LLLineEditor::prevalidateASCIIPrintableNoPipe);
mEditDesc = getChild<LLTextEditor>("Description");
mEditDesc->setCommitOnFocusLost(TRUE);
mEditDesc->setCommitCallback(onCommitAny, this);
- childSetPrevalidate("Description", LLLineEditor::prevalidatePrintableNotPipe);
-
+ // No prevalidate function - historically the prevalidate function was broken,
+ // allowing residents to put in characters like U+2661 WHITE HEART SUIT, so
+ // preserve that ability.
mTextSalePending = getChild<LLTextBox>("SalePending");
mTextOwnerLabel = getChild<LLTextBox>("Owner:");
diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp
index b7296518d4..810761e034 100644
--- a/indra/newview/llfloaternamedesc.cpp
+++ b/indra/newview/llfloaternamedesc.cpp
@@ -111,7 +111,7 @@ BOOL LLFloaterNameDesc::postBuild()
if (NameEditor)
{
NameEditor->setMaxTextLength(DB_INV_ITEM_NAME_STR_LEN);
- NameEditor->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe);
+ NameEditor->setPrevalidate(&LLLineEditor::prevalidateASCIIPrintableNoPipe);
}
y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f);
@@ -123,7 +123,7 @@ BOOL LLFloaterNameDesc::postBuild()
if (DescEditor)
{
DescEditor->setMaxTextLength(DB_INV_ITEM_DESC_STR_LEN);
- DescEditor->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe);
+ DescEditor->setPrevalidate(&LLLineEditor::prevalidateASCIIPrintableNoPipe);
}
y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f);
diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp
index e0d4a59d9d..ff9002787c 100644
--- a/indra/newview/llfloaterproperties.cpp
+++ b/indra/newview/llfloaterproperties.cpp
@@ -130,9 +130,9 @@ BOOL LLFloaterProperties::postBuild()
{
// build the UI
// item name & description
- childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidateASCIIPrintableNoPipe);
getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitName,this));
- childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidateASCIIPrintableNoPipe);
getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLFloaterProperties:: onCommitDescription, this));
// Creator information
getChild<LLUICtrl>("BtnCreator")->setCommitCallback(boost::bind(&LLFloaterProperties::onClickCreator,this));
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 4192c6a586..955bc64e05 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -220,7 +220,7 @@ LLFolderView::LLFolderView(const Params& p)
params.font(getLabelFontForStyle(LLFontGL::NORMAL));
params.max_length_bytes(DB_INV_ITEM_NAME_STR_LEN);
params.commit_callback.function(boost::bind(&LLFolderView::commitRename, this, _2));
- params.prevalidate_callback(&LLLineEditor::prevalidatePrintableNotPipe);
+ params.prevalidate_callback(&LLLineEditor::prevalidateASCIIPrintableNoPipe);
params.commit_on_focus_lost(true);
params.visible(false);
mRenamer = LLUICtrlFactory::create<LLLineEditor> (params);
diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp
index 1c2875bf46..a1d54367c9 100644
--- a/indra/newview/llpanelgroupgeneral.cpp
+++ b/indra/newview/llpanelgroupgeneral.cpp
@@ -213,6 +213,7 @@ void LLPanelGroupGeneral::setupCtrls(LLPanel* panel_group)
}
mFounderName = panel_group->getChild<LLNameBox>("founder_name");
mGroupNameEditor = panel_group->getChild<LLLineEditor>("group_name_editor");
+ mGroupNameEditor->setPrevalidate( LLLineEditor::prevalidateASCII );
}
// static
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index b3e14eb2fb..78f3469f0e 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -210,8 +210,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
}
#if !USE_VIEWER_AUTH
- childSetPrevalidate("first_name_edit", LLLineEditor::prevalidatePrintableNoSpace);
- childSetPrevalidate("last_name_edit", LLLineEditor::prevalidatePrintableNoSpace);
+ childSetPrevalidate("first_name_edit", LLLineEditor::prevalidateASCIIPrintableNoSpace);
+ childSetPrevalidate("last_name_edit", LLLineEditor::prevalidateASCIIPrintableNoSpace);
childSetCommitCallback("password_edit", mungePassword, this);
getChild<LLLineEditor>("password_edit")->setKeystrokeCallback(onPassKey, this);
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp
index 1051326e72..0dc010e2e7 100644
--- a/indra/newview/llpanelpermissions.cpp
+++ b/indra/newview/llpanelpermissions.cpp
@@ -80,9 +80,9 @@ LLPanelPermissions::LLPanelPermissions() :
BOOL LLPanelPermissions::postBuild()
{
childSetCommitCallback("Object Name",LLPanelPermissions::onCommitName,this);
- childSetPrevalidate("Object Name",LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("Object Name",LLLineEditor::prevalidateASCIIPrintableNoPipe);
childSetCommitCallback("Object Description",LLPanelPermissions::onCommitDesc,this);
- childSetPrevalidate("Object Description",LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("Object Description",LLLineEditor::prevalidateASCIIPrintableNoPipe);
getChild<LLUICtrl>("button set group")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickGroup,this));
diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp
index 604faf8eb4..92bd4dc62b 100644
--- a/indra/newview/llpreviewanim.cpp
+++ b/indra/newview/llpreviewanim.cpp
@@ -79,7 +79,7 @@ BOOL LLPreviewAnim::postBuild()
childSetAction("Anim audition btn",auditionAnim, this);
childSetCommitCallback("desc", LLPreview::onText, this);
- childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
return LLPreview::postBuild();
}
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index 7b3a20d102..49a2a3723d 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -493,7 +493,7 @@ BOOL LLPreviewGesture::postBuild()
{
childSetCommitCallback("desc", LLPreview::onText, this);
childSetText("desc", item->getDescription());
- childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
}
return LLPreview::postBuild();
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index ab9cfbf850..ce81077d80 100644
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -96,7 +96,7 @@ BOOL LLPreviewNotecard::postBuild()
childSetCommitCallback("desc", LLPreview::onText, this);
if (item)
childSetText("desc", item->getDescription());
- childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
return LLPreview::postBuild();
}
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 2382befcfa..4e4711f8fb 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -956,7 +956,7 @@ BOOL LLPreviewLSL::postBuild()
childSetCommitCallback("desc", LLPreview::onText, this);
childSetText("desc", item->getDescription());
- childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
return LLPreview::postBuild();
}
diff --git a/indra/newview/llpreviewsound.cpp b/indra/newview/llpreviewsound.cpp
index 7659c50ed3..d7fd252fb6 100644
--- a/indra/newview/llpreviewsound.cpp
+++ b/indra/newview/llpreviewsound.cpp
@@ -75,7 +75,7 @@ BOOL LLPreviewSound::postBuild()
button->setSoundFlags(LLView::SILENT);
childSetCommitCallback("desc", LLPreview::onText, this);
- childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
return LLPreview::postBuild();
}
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 13d02b7dec..41cf402d6f 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -152,7 +152,7 @@ BOOL LLPreviewTexture::postBuild()
{
childSetCommitCallback("desc", LLPreview::onText, this);
childSetText("desc", item->getDescription());
- childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe);
}
}
diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp
index a3efea7b7e..ff6e2d7363 100644
--- a/indra/newview/llsidepaneliteminfo.cpp
+++ b/indra/newview/llsidepaneliteminfo.cpp
@@ -111,9 +111,9 @@ BOOL LLSidepanelItemInfo::postBuild()
// build the UI
// item name & description
- childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidateASCIIPrintableNoPipe);
//getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitName,this));
- childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidateASCIIPrintableNoPipe);
//getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLSidepanelItemInfo:: onCommitDescription, this));
// Creator information
diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp
index 01c832d7d5..4396cce545 100644
--- a/indra/newview/llsidepaneltaskinfo.cpp
+++ b/indra/newview/llsidepaneltaskinfo.cpp
@@ -100,8 +100,8 @@ BOOL LLSidepanelTaskInfo::postBuild()
mBuyBtn = getChild<LLButton>("buy_btn");
mBuyBtn->setClickedCallback(boost::bind(&LLSidepanelTaskInfo::onBuyButtonClicked, this));
- childSetPrevalidate("Object Name",LLLineEditor::prevalidatePrintableNotPipe);
- childSetPrevalidate("Object Description",LLLineEditor::prevalidatePrintableNotPipe);
+ childSetPrevalidate("Object Name",LLLineEditor::prevalidateASCIIPrintableNoPipe);
+ childSetPrevalidate("Object Description",LLLineEditor::prevalidateASCIIPrintableNoPipe);
// getChild<LLUICtrl>("button set group")->setCommitCallback(boost::bind(&LLSidepanelTaskInfo::onClickGroup,this));
// childSetAction("button deed",LLSidepanelTaskInfo::onClickDeedToGroup,this);
diff --git a/indra/newview/skins/default/xui/en/floater_test_line_editor.xml b/indra/newview/skins/default/xui/en/floater_test_line_editor.xml
index e017d404c6..0531b52e5a 100644
--- a/indra/newview/skins/default/xui/en/floater_test_line_editor.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_line_editor.xml
@@ -18,7 +18,18 @@
Enabled line editor
</line_editor>
<line_editor
- enabled="false"
+ height="20"
+ layout="topleft"
+ left_delta="0"
+ name="ascii_line_editor"
+ prevalidate_callback="ascii"
+ tool_tip="ascii line editor"
+ top_pad="10"
+ width="200">
+ ASCII only line editor
+ </line_editor>
+ <line_editor
+ enabled="false"
height="20"
layout="topleft"
left_delta="0"
diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml
index b2f46bc433..944b4cda98 100644
--- a/indra/newview/skins/default/xui/en/floater_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_tools.xml
@@ -809,11 +809,8 @@
Mixed Sale
</panel.string>
<text
- type="string"
- length="1"
follows="left|top"
height="10"
- layout="topleft"
left="10"
name="Name:"
top="0"
@@ -823,7 +820,6 @@
<line_editor
follows="left|top|right"
height="19"
- layout="topleft"
left_pad="0"
max_length="63"
name="Object Name"
@@ -831,11 +827,8 @@
top_delta="0"
width="170" />
<text
- type="string"
- length="1"
follows="left|top"
height="10"
- layout="topleft"
left="10"
name="Description:"
top_pad="3"
@@ -845,7 +838,6 @@
<line_editor
follows="left|top|right"
height="19"
- layout="topleft"
left_pad="0"
max_length="127"
name="Object Description"