diff options
Diffstat (limited to 'linden/indra')
-rw-r--r-- | linden/indra/newview/floaterlogin.cpp | 2 | ||||
-rw-r--r-- | linden/indra/newview/hippoGridManager.cpp | 52 | ||||
-rw-r--r-- | linden/indra/newview/hippoGridManager.h | 4 |
3 files changed, 31 insertions, 27 deletions
diff --git a/linden/indra/newview/floaterlogin.cpp b/linden/indra/newview/floaterlogin.cpp index 17e4d0c..e393603 100644 --- a/linden/indra/newview/floaterlogin.cpp +++ b/linden/indra/newview/floaterlogin.cpp | |||
@@ -311,8 +311,6 @@ bool LoginFloater::createNewGrid() | |||
311 | // check nickname | 311 | // check nickname |
312 | std::string gridnick = childGetValue("gridnick"); | 312 | std::string gridnick = childGetValue("gridnick"); |
313 | if (gridnick == "<required>") gridnick = ""; | 313 | if (gridnick == "<required>") gridnick = ""; |
314 | HippoGridInfo::cleanUpGridNick(gridnick); | ||
315 | childSetValue("gridnick", (gridnick != "")? gridnick: "<required>"); | ||
316 | if (gridnick == "") { | 314 | if (gridnick == "") { |
317 | //KOW gViewerWindow->alertXml("GridsNoNick"); | 315 | //KOW gViewerWindow->alertXml("GridsNoNick"); |
318 | return false; | 316 | return false; |
diff --git a/linden/indra/newview/hippoGridManager.cpp b/linden/indra/newview/hippoGridManager.cpp index ffac92d..485be20 100644 --- a/linden/indra/newview/hippoGridManager.cpp +++ b/linden/indra/newview/hippoGridManager.cpp | |||
@@ -38,13 +38,13 @@ HippoGridInfo HippoGridInfo::FALLBACK_GRIDINFO(""); | |||
38 | 38 | ||
39 | HippoGridInfo::HippoGridInfo(const std::string &gridNick) : | 39 | HippoGridInfo::HippoGridInfo(const std::string &gridNick) : |
40 | mPlatform(PLATFORM_OTHER), | 40 | mPlatform(PLATFORM_OTHER), |
41 | mGridNick(gridNick), | ||
42 | mRenderCompat(true), | 41 | mRenderCompat(true), |
43 | mCurrencySymbol("OS$"), | 42 | mCurrencySymbol("OS$"), |
44 | mRealCurrencySymbol("US$"), | 43 | mRealCurrencySymbol("US$"), |
45 | mDirectoryFee(30) | 44 | mDirectoryFee(30) |
46 | { | 45 | { |
47 | cleanUpGridNick(mGridNick); | 46 | std::string nick = gridNick; |
47 | mGridNick = sanitizeGridNick( nick ); | ||
48 | } | 48 | } |
49 | 49 | ||
50 | 50 | ||
@@ -181,8 +181,8 @@ void HippoGridInfo::setGridName(const std::string &gridName) | |||
181 | 181 | ||
182 | void HippoGridInfo::setLoginUri(const std::string &loginUri) | 182 | void HippoGridInfo::setLoginUri(const std::string &loginUri) |
183 | { | 183 | { |
184 | mLoginUri = loginUri; | 184 | std::string uri = loginUri; |
185 | cleanUpUri(mLoginUri); | 185 | mLoginUri = sanitizeUri(uri); |
186 | } | 186 | } |
187 | 187 | ||
188 | void HippoGridInfo::setLoginPage(const std::string &loginPage) | 188 | void HippoGridInfo::setLoginPage(const std::string &loginPage) |
@@ -192,8 +192,8 @@ void HippoGridInfo::setLoginPage(const std::string &loginPage) | |||
192 | 192 | ||
193 | void HippoGridInfo::setHelperUri(const std::string &helperUri) | 193 | void HippoGridInfo::setHelperUri(const std::string &helperUri) |
194 | { | 194 | { |
195 | mHelperUri = helperUri; | 195 | std::string uri = helperUri; |
196 | cleanUpUri(mHelperUri); | 196 | mHelperUri = sanitizeUri(uri); |
197 | } | 197 | } |
198 | 198 | ||
199 | void HippoGridInfo::setWebSite(const std::string &website) | 199 | void HippoGridInfo::setWebSite(const std::string &website) |
@@ -332,10 +332,11 @@ void HippoGridInfo::onXmlCharacterData(void *userData, const XML_Char *s, int le | |||
332 | HippoGridInfo *self = (HippoGridInfo*)userData; | 332 | HippoGridInfo *self = (HippoGridInfo*)userData; |
333 | switch (self->mXmlState) { | 333 | switch (self->mXmlState) { |
334 | 334 | ||
335 | case XML_GRIDNICK: | 335 | case XML_GRIDNICK: { |
336 | if (self->mGridNick == "") self->mGridNick.assign(s, len); | 336 | if (self->mGridNick == "") self->mGridNick.assign(s, len); |
337 | cleanUpGridNick(self->mGridNick); | 337 | self->mGridNick = sanitizeGridNick(self->mGridNick); |
338 | break; | 338 | break; |
339 | } | ||
339 | 340 | ||
340 | case XML_PLATFORM: { | 341 | case XML_PLATFORM: { |
341 | std::string platform(s, len); | 342 | std::string platform(s, len); |
@@ -343,26 +344,29 @@ void HippoGridInfo::onXmlCharacterData(void *userData, const XML_Char *s, int le | |||
343 | break; | 344 | break; |
344 | } | 345 | } |
345 | 346 | ||
346 | case XML_LOGINURI: | 347 | case XML_LOGINURI: { |
347 | self->mLoginUri.assign(s, len); | 348 | std::string loginuri(s, len); |
348 | cleanUpUri(self->mLoginUri); | 349 | self->mLoginUri = sanitizeUri( loginuri ); |
349 | break; | 350 | break; |
351 | } | ||
350 | 352 | ||
351 | case XML_HELPERURI: | 353 | case XML_HELPERURI: { |
352 | self->mHelperUri.assign(s, len); | 354 | std::string helperuri(s, len); |
353 | cleanUpUri(self->mHelperUri); | 355 | self->mHelperUri = sanitizeUri( helperuri ); |
354 | break; | 356 | break; |
357 | } | ||
355 | 358 | ||
356 | case XML_SEARCH: | 359 | case XML_SEARCH: { |
357 | //self->mSearchUrl.assign(s, len); | 360 | //self->mSearchUrl.assign(s, len); |
358 | //cleanUpQueryUrl(mSearchUrl); | 361 | //sanitizeQueryUrl(mSearchUrl); |
359 | break; | 362 | break; |
363 | } | ||
360 | 364 | ||
361 | case XML_GRIDNAME: self->mGridName.assign(s, len); break; | 365 | case XML_GRIDNAME: self->mGridName.assign(s, len); break; |
362 | case XML_LOGINPAGE: self->mLoginPage.assign(s, len); break; | 366 | case XML_LOGINPAGE: self->mLoginPage.assign(s, len); break; |
363 | case XML_WEBSITE: self->mWebSite.assign(s, len); break; | 367 | case XML_WEBSITE: self->mWebSite.assign(s, len); break; |
364 | case XML_SUPPORT: self->mSupportUrl.assign(s, len); break; | 368 | case XML_SUPPORT: self->mSupportUrl.assign(s, len); break; |
365 | case XML_REGISTER: self->mRegisterUrl.assign(s, len); break; | 369 | case XML_REGISTER: self->mRegisterUrl.assign(s, len); break; |
366 | case XML_PASSWORD: self->mPasswordUrl.assign(s, len); break; | 370 | case XML_PASSWORD: self->mPasswordUrl.assign(s, len); break; |
367 | 371 | ||
368 | case XML_VOID: break; | 372 | case XML_VOID: break; |
@@ -445,7 +449,7 @@ const char *HippoGridInfo::getPlatformString(Platform platform) | |||
445 | 449 | ||
446 | 450 | ||
447 | // static | 451 | // static |
448 | void HippoGridInfo::cleanUpGridNick(std::string &gridnick) | 452 | std::string HippoGridInfo::sanitizeGridNick(std::string &gridnick) |
449 | { | 453 | { |
450 | std::string tmp; | 454 | std::string tmp; |
451 | int size = gridnick.size(); | 455 | int size = gridnick.size(); |
@@ -457,20 +461,22 @@ void HippoGridInfo::cleanUpGridNick(std::string &gridnick) | |||
457 | tmp += "_"; | 461 | tmp += "_"; |
458 | } | 462 | } |
459 | } | 463 | } |
460 | gridnick = tmp; | 464 | return tmp; |
461 | } | 465 | } |
462 | 466 | ||
463 | // static | 467 | // static |
464 | void HippoGridInfo::cleanUpUri(std::string &uri) | 468 | std::string HippoGridInfo::sanitizeUri(std::string &uri) |
465 | { | 469 | { |
466 | if (uri.empty()) { | 470 | if (uri.empty()) { |
467 | return; | 471 | return ""; |
468 | } | 472 | } |
469 | 473 | ||
470 | // If last character in uri is not "/" | 474 | // If last character in uri is not "/" |
471 | if (uri.compare(uri.length()-1, 1, "/") != 0) { | 475 | if (uri.compare(uri.length()-1, 1, "/") != 0) { |
472 | uri += '/'; | 476 | return uri + '/'; |
473 | } | 477 | } |
478 | |||
479 | return uri; | ||
474 | } | 480 | } |
475 | 481 | ||
476 | 482 | ||
diff --git a/linden/indra/newview/hippoGridManager.h b/linden/indra/newview/hippoGridManager.h index de69e5b..ef351d9 100644 --- a/linden/indra/newview/hippoGridManager.h +++ b/linden/indra/newview/hippoGridManager.h | |||
@@ -83,7 +83,7 @@ public: | |||
83 | bool retrieveGridInfo(); | 83 | bool retrieveGridInfo(); |
84 | 84 | ||
85 | static const char *getPlatformString(Platform platform); | 85 | static const char *getPlatformString(Platform platform); |
86 | static void cleanUpGridNick(std::string &gridnick); | 86 | static std::string sanitizeGridNick(std::string &gridnick); |
87 | 87 | ||
88 | static HippoGridInfo FALLBACK_GRIDINFO; | 88 | static HippoGridInfo FALLBACK_GRIDINFO; |
89 | static void initFallback(); | 89 | static void initFallback(); |
@@ -117,7 +117,7 @@ private: | |||
117 | }; | 117 | }; |
118 | XmlState mXmlState; | 118 | XmlState mXmlState; |
119 | 119 | ||
120 | static void cleanUpUri(std::string &uri); | 120 | static std::string sanitizeUri(std::string &uri); |
121 | void formatFee(std::string &fee, int cost, bool showFree) const; | 121 | void formatFee(std::string &fee, int cost, bool showFree) const; |
122 | 122 | ||
123 | static void onXmlElementStart(void *userData, const XML_Char *name, const XML_Char **atts); | 123 | static void onXmlElementStart(void *userData, const XML_Char *name, const XML_Char **atts); |