diff options
author | Jacek Antonelli | 2009-09-10 02:31:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-09-10 02:35:58 -0500 |
commit | f57eabefa1291f4e047aa03416c9c544413b9f0e (patch) | |
tree | 25f1d75d05a8b00f3c2b7207731a9cfafdad9732 /linden/indra/newview/hippoGridManager.cpp | |
parent | Merged 'armin/grid-manager5' into login-manager (diff) | |
download | meta-impy-f57eabefa1291f4e047aa03416c9c544413b9f0e.zip meta-impy-f57eabefa1291f4e047aa03416c9c544413b9f0e.tar.gz meta-impy-f57eabefa1291f4e047aa03416c9c544413b9f0e.tar.bz2 meta-impy-f57eabefa1291f4e047aa03416c9c544413b9f0e.tar.xz |
Fixed line endings on hippo and grid manager files.
Diffstat (limited to 'linden/indra/newview/hippoGridManager.cpp')
-rw-r--r-- | linden/indra/newview/hippoGridManager.cpp | 1194 |
1 files changed, 597 insertions, 597 deletions
diff --git a/linden/indra/newview/hippoGridManager.cpp b/linden/indra/newview/hippoGridManager.cpp index 8415adb..19ed2c4 100644 --- a/linden/indra/newview/hippoGridManager.cpp +++ b/linden/indra/newview/hippoGridManager.cpp | |||
@@ -1,597 +1,597 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include "hippoGridManager.h" | 3 | #include "hippoGridManager.h" |
4 | 4 | ||
5 | #include <cctype> | 5 | #include <cctype> |
6 | 6 | ||
7 | #include <stdtypes.h> | 7 | #include <stdtypes.h> |
8 | #include <lldir.h> | 8 | #include <lldir.h> |
9 | #include <lleconomy.h> | 9 | #include <lleconomy.h> |
10 | #include <llerror.h> | 10 | #include <llerror.h> |
11 | #include <llfile.h> | 11 | #include <llfile.h> |
12 | #include <llhttpclient.h> | 12 | #include <llhttpclient.h> |
13 | #include <llsdserialize.h> | 13 | #include <llsdserialize.h> |
14 | #include "llviewercontrol.h" | 14 | #include "llviewercontrol.h" |
15 | #include "llweb.h" | 15 | #include "llweb.h" |
16 | 16 | ||
17 | #include "hippoRestRequest.h" | 17 | #include "hippoRestRequest.h" |
18 | 18 | ||
19 | 19 | ||
20 | // ******************************************************************** | 20 | // ******************************************************************** |
21 | // Global Variables | 21 | // Global Variables |
22 | 22 | ||
23 | HippoGridManager *gHippoGridManager = 0; | 23 | HippoGridManager *gHippoGridManager = 0; |
24 | 24 | ||
25 | HippoGridInfo HippoGridInfo::FALLBACK_GRIDINFO(""); | 25 | HippoGridInfo HippoGridInfo::FALLBACK_GRIDINFO(""); |
26 | 26 | ||
27 | 27 | ||
28 | 28 | ||
29 | // ******************************************************************** | 29 | // ******************************************************************** |
30 | // ******************************************************************** | 30 | // ******************************************************************** |
31 | // HippoGridInfo | 31 | // HippoGridInfo |
32 | // ******************************************************************** | 32 | // ******************************************************************** |
33 | // ******************************************************************** | 33 | // ******************************************************************** |
34 | 34 | ||
35 | 35 | ||
36 | // ******************************************************************** | 36 | // ******************************************************************** |
37 | // Initialize | 37 | // Initialize |
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), | 41 | mGridNick(gridNick), |
42 | mRenderCompat(true), | 42 | mRenderCompat(true), |
43 | mCurrencySymbol("OS$"), | 43 | mCurrencySymbol("OS$"), |
44 | mRealCurrencySymbol("US$"), | 44 | mRealCurrencySymbol("US$"), |
45 | mDirectoryFee(30) | 45 | mDirectoryFee(30) |
46 | { | 46 | { |
47 | cleanUpGridNick(mGridNick); | 47 | cleanUpGridNick(mGridNick); |
48 | } | 48 | } |
49 | 49 | ||
50 | 50 | ||
51 | void HippoGridInfo::setPlatform(Platform platform) | 51 | void HippoGridInfo::setPlatform(Platform platform) |
52 | { | 52 | { |
53 | mPlatform = platform; | 53 | mPlatform = platform; |
54 | mCurrencySymbol = (mPlatform == PLATFORM_SECONDLIFE)? "L$": "OS$"; | 54 | mCurrencySymbol = (mPlatform == PLATFORM_SECONDLIFE)? "L$": "OS$"; |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | void HippoGridInfo::setPlatform(const std::string &platform) | 58 | void HippoGridInfo::setPlatform(const std::string &platform) |
59 | { | 59 | { |
60 | std::string tmp = platform; | 60 | std::string tmp = platform; |
61 | for (unsigned i=0; i<platform.size(); i++) | 61 | for (unsigned i=0; i<platform.size(); i++) |
62 | tmp[i] = tolower(tmp[i]); | 62 | tmp[i] = tolower(tmp[i]); |
63 | 63 | ||
64 | if (tmp == "opensim") { | 64 | if (tmp == "opensim") { |
65 | setPlatform(PLATFORM_OPENSIM); | 65 | setPlatform(PLATFORM_OPENSIM); |
66 | } else if (tmp == "secondlife") { | 66 | } else if (tmp == "secondlife") { |
67 | setPlatform(PLATFORM_SECONDLIFE); | 67 | setPlatform(PLATFORM_SECONDLIFE); |
68 | } else { | 68 | } else { |
69 | setPlatform(PLATFORM_OTHER); | 69 | setPlatform(PLATFORM_OTHER); |
70 | llwarns << "Unknown platform '" << platform << "'." << llendl; | 70 | llwarns << "Unknown platform '" << platform << "'." << llendl; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
75 | // ******************************************************************** | 75 | // ******************************************************************** |
76 | // Grid Info | 76 | // Grid Info |
77 | 77 | ||
78 | std::string HippoGridInfo::getSearchUrl(SearchType ty) const | 78 | std::string HippoGridInfo::getSearchUrl(SearchType ty) const |
79 | { | 79 | { |
80 | if ((mPlatform == PLATFORM_SECONDLIFE) || mSearchUrl.empty()) { | 80 | if ((mPlatform == PLATFORM_SECONDLIFE) || mSearchUrl.empty()) { |
81 | // Second Life defaults | 81 | // Second Life defaults |
82 | if (ty == SEARCH_ALL_EMPTY) { | 82 | if (ty == SEARCH_ALL_EMPTY) { |
83 | return gSavedSettings.getString("SearchURLDefault"); | 83 | return gSavedSettings.getString("SearchURLDefault"); |
84 | } else if (ty == SEARCH_ALL_QUERY) { | 84 | } else if (ty == SEARCH_ALL_QUERY) { |
85 | return gSavedSettings.getString("SearchURLQuery"); | 85 | return gSavedSettings.getString("SearchURLQuery"); |
86 | } else if (ty == SEARCH_ALL_TEMPLATE) { | 86 | } else if (ty == SEARCH_ALL_TEMPLATE) { |
87 | return gSavedSettings.getString("SearchURLSuffix2"); | 87 | return gSavedSettings.getString("SearchURLSuffix2"); |
88 | } else { | 88 | } else { |
89 | llinfos << "Illegal search URL type " << ty << llendl; | 89 | llinfos << "Illegal search URL type " << ty << llendl; |
90 | return ""; | 90 | return ""; |
91 | } | 91 | } |
92 | } else { | 92 | } else { |
93 | // OpenSim and other | 93 | // OpenSim and other |
94 | if (ty == SEARCH_ALL_EMPTY) { | 94 | if (ty == SEARCH_ALL_EMPTY) { |
95 | return (mSearchUrl + "panel=All&"); | 95 | return (mSearchUrl + "panel=All&"); |
96 | } else if (ty == SEARCH_ALL_QUERY) { | 96 | } else if (ty == SEARCH_ALL_QUERY) { |
97 | return (mSearchUrl + "q=[QUERY]&s=[COLLECTION]&"); | 97 | return (mSearchUrl + "q=[QUERY]&s=[COLLECTION]&"); |
98 | } else if (ty == SEARCH_ALL_TEMPLATE) { | 98 | } else if (ty == SEARCH_ALL_TEMPLATE) { |
99 | return "lang=[LANG]&m=[MATURE]&t=[TEEN]®ion=[REGION]&x=[X]&y=[Y]&z=[Z]&session=[SESSION]"; | 99 | return "lang=[LANG]&m=[MATURE]&t=[TEEN]®ion=[REGION]&x=[X]&y=[Y]&z=[Z]&session=[SESSION]"; |
100 | } else { | 100 | } else { |
101 | llinfos << "Illegal search URL type " << ty << llendl; | 101 | llinfos << "Illegal search URL type " << ty << llendl; |
102 | return ""; | 102 | return ""; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | 107 | ||
108 | //static | 108 | //static |
109 | void HippoGridInfo::onXmlElementStart(void *userData, const XML_Char *name, const XML_Char **atts) | 109 | void HippoGridInfo::onXmlElementStart(void *userData, const XML_Char *name, const XML_Char **atts) |
110 | { | 110 | { |
111 | HippoGridInfo *self = (HippoGridInfo*)userData; | 111 | HippoGridInfo *self = (HippoGridInfo*)userData; |
112 | if (strcasecmp(name, "gridnick") == 0) | 112 | if (strcasecmp(name, "gridnick") == 0) |
113 | self->mXmlState = XML_GRIDNICK; | 113 | self->mXmlState = XML_GRIDNICK; |
114 | else if (strcasecmp(name, "gridname") == 0) | 114 | else if (strcasecmp(name, "gridname") == 0) |
115 | self->mXmlState = XML_GRIDNAME; | 115 | self->mXmlState = XML_GRIDNAME; |
116 | else if (strcasecmp(name, "platform") == 0) | 116 | else if (strcasecmp(name, "platform") == 0) |
117 | self->mXmlState = XML_PLATFORM; | 117 | self->mXmlState = XML_PLATFORM; |
118 | else if ((strcasecmp(name, "login") == 0) || (strcasecmp(name, "loginuri") == 0)) | 118 | else if ((strcasecmp(name, "login") == 0) || (strcasecmp(name, "loginuri") == 0)) |
119 | self->mXmlState = XML_LOGINURI; | 119 | self->mXmlState = XML_LOGINURI; |
120 | else if ((strcasecmp(name, "welcome") == 0) || (strcasecmp(name, "loginpage") == 0)) | 120 | else if ((strcasecmp(name, "welcome") == 0) || (strcasecmp(name, "loginpage") == 0)) |
121 | self->mXmlState = XML_LOGINPAGE; | 121 | self->mXmlState = XML_LOGINPAGE; |
122 | else if ((strcasecmp(name, "economy") == 0) || (strcasecmp(name, "helperuri") == 0)) | 122 | else if ((strcasecmp(name, "economy") == 0) || (strcasecmp(name, "helperuri") == 0)) |
123 | self->mXmlState = XML_HELPERURI; | 123 | self->mXmlState = XML_HELPERURI; |
124 | else if ((strcasecmp(name, "about") == 0) || (strcasecmp(name, "website") == 0)) | 124 | else if ((strcasecmp(name, "about") == 0) || (strcasecmp(name, "website") == 0)) |
125 | self->mXmlState = XML_WEBSITE; | 125 | self->mXmlState = XML_WEBSITE; |
126 | else if ((strcasecmp(name, "help") == 0) || (strcasecmp(name, "support") == 0)) | 126 | else if ((strcasecmp(name, "help") == 0) || (strcasecmp(name, "support") == 0)) |
127 | self->mXmlState = XML_SUPPORT; | 127 | self->mXmlState = XML_SUPPORT; |
128 | else if ((strcasecmp(name, "register") == 0) || (strcasecmp(name, "account") == 0)) | 128 | else if ((strcasecmp(name, "register") == 0) || (strcasecmp(name, "account") == 0)) |
129 | self->mXmlState = XML_REGISTER; | 129 | self->mXmlState = XML_REGISTER; |
130 | else if (strcasecmp(name, "password") == 0) | 130 | else if (strcasecmp(name, "password") == 0) |
131 | self->mXmlState = XML_PASSWORD; | 131 | self->mXmlState = XML_PASSWORD; |
132 | //else if (strcasecmp(name, "search") == 0) | 132 | //else if (strcasecmp(name, "search") == 0) |
133 | //self->mXmlState = XML_SEARCH; | 133 | //self->mXmlState = XML_SEARCH; |
134 | } | 134 | } |
135 | 135 | ||
136 | //static | 136 | //static |
137 | void HippoGridInfo::onXmlElementEnd(void *userData, const XML_Char *name) | 137 | void HippoGridInfo::onXmlElementEnd(void *userData, const XML_Char *name) |
138 | { | 138 | { |
139 | HippoGridInfo *self = (HippoGridInfo*)userData; | 139 | HippoGridInfo *self = (HippoGridInfo*)userData; |
140 | self->mXmlState = XML_VOID; | 140 | self->mXmlState = XML_VOID; |
141 | } | 141 | } |
142 | 142 | ||
143 | //static | 143 | //static |
144 | void HippoGridInfo::onXmlCharacterData(void *userData, const XML_Char *s, int len) | 144 | void HippoGridInfo::onXmlCharacterData(void *userData, const XML_Char *s, int len) |
145 | { | 145 | { |
146 | HippoGridInfo *self = (HippoGridInfo*)userData; | 146 | HippoGridInfo *self = (HippoGridInfo*)userData; |
147 | switch (self->mXmlState) { | 147 | switch (self->mXmlState) { |
148 | 148 | ||
149 | case XML_GRIDNICK: | 149 | case XML_GRIDNICK: |
150 | if (self->mGridNick == "") self->mGridNick.assign(s, len); | 150 | if (self->mGridNick == "") self->mGridNick.assign(s, len); |
151 | cleanUpGridNick(self->mGridNick); | 151 | cleanUpGridNick(self->mGridNick); |
152 | break; | 152 | break; |
153 | 153 | ||
154 | case XML_PLATFORM: { | 154 | case XML_PLATFORM: { |
155 | std::string platform(s, len); | 155 | std::string platform(s, len); |
156 | self->setPlatform(platform); | 156 | self->setPlatform(platform); |
157 | break; | 157 | break; |
158 | } | 158 | } |
159 | 159 | ||
160 | case XML_LOGINURI: | 160 | case XML_LOGINURI: |
161 | self->mLoginUri.assign(s, len); | 161 | self->mLoginUri.assign(s, len); |
162 | cleanUpUri(self->mLoginUri); | 162 | cleanUpUri(self->mLoginUri); |
163 | break; | 163 | break; |
164 | 164 | ||
165 | case XML_HELPERURI: | 165 | case XML_HELPERURI: |
166 | self->mHelperUri.assign(s, len); | 166 | self->mHelperUri.assign(s, len); |
167 | cleanUpUri(self->mHelperUri); | 167 | cleanUpUri(self->mHelperUri); |
168 | break; | 168 | break; |
169 | 169 | ||
170 | case XML_SEARCH: | 170 | case XML_SEARCH: |
171 | //self->mSearchUrl.assign(s, len); | 171 | //self->mSearchUrl.assign(s, len); |
172 | //cleanUpQueryUrl(mSearchUrl); | 172 | //cleanUpQueryUrl(mSearchUrl); |
173 | break; | 173 | break; |
174 | 174 | ||
175 | case XML_GRIDNAME: self->mGridName.assign(s, len); break; | 175 | case XML_GRIDNAME: self->mGridName.assign(s, len); break; |
176 | case XML_LOGINPAGE: self->mLoginPage.assign(s, len); break; | 176 | case XML_LOGINPAGE: self->mLoginPage.assign(s, len); break; |
177 | case XML_WEBSITE: self->mWebSite.assign(s, len); break; | 177 | case XML_WEBSITE: self->mWebSite.assign(s, len); break; |
178 | case XML_SUPPORT: self->mSupportUrl.assign(s, len); break; | 178 | case XML_SUPPORT: self->mSupportUrl.assign(s, len); break; |
179 | case XML_REGISTER: self->mRegisterUrl.assign(s, len); break; | 179 | case XML_REGISTER: self->mRegisterUrl.assign(s, len); break; |
180 | case XML_PASSWORD: self->mPasswordUrl.assign(s, len); break; | 180 | case XML_PASSWORD: self->mPasswordUrl.assign(s, len); break; |
181 | 181 | ||
182 | case XML_VOID: break; | 182 | case XML_VOID: break; |
183 | } | 183 | } |
184 | } | 184 | } |
185 | 185 | ||
186 | 186 | ||
187 | bool HippoGridInfo::retrieveGridInfo() | 187 | bool HippoGridInfo::retrieveGridInfo() |
188 | { | 188 | { |
189 | if (mLoginUri == "") return false; | 189 | if (mLoginUri == "") return false; |
190 | 190 | ||
191 | std::string reply; | 191 | std::string reply; |
192 | int result = HippoRestRequest::getBlocking(mLoginUri + "get_grid_info", &reply); | 192 | int result = HippoRestRequest::getBlocking(mLoginUri + "get_grid_info", &reply); |
193 | if (result != 200) return false; | 193 | if (result != 200) return false; |
194 | 194 | ||
195 | llinfos << "Received: " << reply << llendl; | 195 | llinfos << "Received: " << reply << llendl; |
196 | 196 | ||
197 | bool success = true; | 197 | bool success = true; |
198 | XML_Parser parser = XML_ParserCreate(0); | 198 | XML_Parser parser = XML_ParserCreate(0); |
199 | XML_SetUserData(parser, this); | 199 | XML_SetUserData(parser, this); |
200 | XML_SetElementHandler(parser, onXmlElementStart, onXmlElementEnd); | 200 | XML_SetElementHandler(parser, onXmlElementStart, onXmlElementEnd); |
201 | XML_SetCharacterDataHandler(parser, onXmlCharacterData); | 201 | XML_SetCharacterDataHandler(parser, onXmlCharacterData); |
202 | mXmlState = XML_VOID; | 202 | mXmlState = XML_VOID; |
203 | if (!XML_Parse(parser, reply.data(), reply.size(), TRUE)) { | 203 | if (!XML_Parse(parser, reply.data(), reply.size(), TRUE)) { |
204 | llwarns << "XML Parse Error: " << XML_ErrorString(XML_GetErrorCode(parser)) << llendl; | 204 | llwarns << "XML Parse Error: " << XML_ErrorString(XML_GetErrorCode(parser)) << llendl; |
205 | success = false; | 205 | success = false; |
206 | } | 206 | } |
207 | XML_ParserFree(parser); | 207 | XML_ParserFree(parser); |
208 | 208 | ||
209 | return success; | 209 | return success; |
210 | } | 210 | } |
211 | 211 | ||
212 | 212 | ||
213 | std::string HippoGridInfo::getUploadFee() const | 213 | std::string HippoGridInfo::getUploadFee() const |
214 | { | 214 | { |
215 | std::string fee; | 215 | std::string fee; |
216 | formatFee(fee, LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(), true); | 216 | formatFee(fee, LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(), true); |
217 | return fee; | 217 | return fee; |
218 | } | 218 | } |
219 | 219 | ||
220 | std::string HippoGridInfo::getGroupCreationFee() const | 220 | std::string HippoGridInfo::getGroupCreationFee() const |
221 | { | 221 | { |
222 | std::string fee; | 222 | std::string fee; |
223 | formatFee(fee, LLGlobalEconomy::Singleton::getInstance()->getPriceGroupCreate(), false); | 223 | formatFee(fee, LLGlobalEconomy::Singleton::getInstance()->getPriceGroupCreate(), false); |
224 | return fee; | 224 | return fee; |
225 | } | 225 | } |
226 | 226 | ||
227 | std::string HippoGridInfo::getDirectoryFee() const | 227 | std::string HippoGridInfo::getDirectoryFee() const |
228 | { | 228 | { |
229 | std::string fee; | 229 | std::string fee; |
230 | formatFee(fee, mDirectoryFee, true); | 230 | formatFee(fee, mDirectoryFee, true); |
231 | if (fee != "free") fee += "/week"; | 231 | if (fee != "free") fee += "/week"; |
232 | return fee; | 232 | return fee; |
233 | } | 233 | } |
234 | 234 | ||
235 | void HippoGridInfo::formatFee(std::string &fee, int cost, bool showFree) const | 235 | void HippoGridInfo::formatFee(std::string &fee, int cost, bool showFree) const |
236 | { | 236 | { |
237 | if (showFree && (cost == 0)) { | 237 | if (showFree && (cost == 0)) { |
238 | fee = "free"; | 238 | fee = "free"; |
239 | } else { | 239 | } else { |
240 | fee = llformat("%s%d", getCurrencySymbol().c_str(), cost); | 240 | fee = llformat("%s%d", getCurrencySymbol().c_str(), cost); |
241 | } | 241 | } |
242 | } | 242 | } |
243 | 243 | ||
244 | 244 | ||
245 | // ******************************************************************** | 245 | // ******************************************************************** |
246 | // Static Helpers | 246 | // Static Helpers |
247 | 247 | ||
248 | // static | 248 | // static |
249 | const char *HippoGridInfo::getPlatformString(Platform platform) | 249 | const char *HippoGridInfo::getPlatformString(Platform platform) |
250 | { | 250 | { |
251 | static const char *platformStrings[PLATFORM_LAST] = { | 251 | static const char *platformStrings[PLATFORM_LAST] = { |
252 | "Other", "OpenSim", "SecondLife" | 252 | "Other", "OpenSim", "SecondLife" |
253 | }; | 253 | }; |
254 | 254 | ||
255 | if ((platform < PLATFORM_OTHER) || (platform >= PLATFORM_LAST)) | 255 | if ((platform < PLATFORM_OTHER) || (platform >= PLATFORM_LAST)) |
256 | platform = PLATFORM_OTHER; | 256 | platform = PLATFORM_OTHER; |
257 | return platformStrings[platform]; | 257 | return platformStrings[platform]; |
258 | } | 258 | } |
259 | 259 | ||
260 | 260 | ||
261 | // static | 261 | // static |
262 | void HippoGridInfo::cleanUpGridNick(std::string &gridnick) | 262 | void HippoGridInfo::cleanUpGridNick(std::string &gridnick) |
263 | { | 263 | { |
264 | std::string tmp; | 264 | std::string tmp; |
265 | int size = gridnick.size(); | 265 | int size = gridnick.size(); |
266 | for (int i=0; i<size; i++) { | 266 | for (int i=0; i<size; i++) { |
267 | char c = gridnick[i]; | 267 | char c = gridnick[i]; |
268 | if ((c == '_') || isalnum(c)) { | 268 | if ((c == '_') || isalnum(c)) { |
269 | tmp += tolower(c); | 269 | tmp += tolower(c); |
270 | } else if (isspace(c)) { | 270 | } else if (isspace(c)) { |
271 | tmp += "_"; | 271 | tmp += "_"; |
272 | } | 272 | } |
273 | } | 273 | } |
274 | gridnick = tmp; | 274 | gridnick = tmp; |
275 | } | 275 | } |
276 | 276 | ||
277 | // static | 277 | // static |
278 | void HippoGridInfo::cleanUpUri(std::string &uri) | 278 | void HippoGridInfo::cleanUpUri(std::string &uri) |
279 | { | 279 | { |
280 | std::string::size_type n = uri.rfind('/'); | 280 | std::string::size_type n = uri.rfind('/'); |
281 | if ((n == std::string::npos) || (n < 10)) | 281 | if ((n == std::string::npos) || (n < 10)) |
282 | uri += '/'; | 282 | uri += '/'; |
283 | } | 283 | } |
284 | 284 | ||
285 | 285 | ||
286 | void HippoGridInfo::initFallback() | 286 | void HippoGridInfo::initFallback() |
287 | { | 287 | { |
288 | FALLBACK_GRIDINFO.mGridNick = "secondlife"; | 288 | FALLBACK_GRIDINFO.mGridNick = "secondlife"; |
289 | FALLBACK_GRIDINFO.setPlatform(PLATFORM_SECONDLIFE); | 289 | FALLBACK_GRIDINFO.setPlatform(PLATFORM_SECONDLIFE); |
290 | FALLBACK_GRIDINFO.setGridName("Second Life"); | 290 | FALLBACK_GRIDINFO.setGridName("Second Life"); |
291 | FALLBACK_GRIDINFO.setLoginUri("https://login.agni.lindenlab.com/cgi-bin/login.cgi"); | 291 | FALLBACK_GRIDINFO.setLoginUri("https://login.agni.lindenlab.com/cgi-bin/login.cgi"); |
292 | FALLBACK_GRIDINFO.setLoginPage("http://secondlife.com/app/login/"); | 292 | FALLBACK_GRIDINFO.setLoginPage("http://secondlife.com/app/login/"); |
293 | FALLBACK_GRIDINFO.setHelperUri("https://secondlife.com/helpers/"); | 293 | FALLBACK_GRIDINFO.setHelperUri("https://secondlife.com/helpers/"); |
294 | FALLBACK_GRIDINFO.setWebSite("http://secondlife.com/"); | 294 | FALLBACK_GRIDINFO.setWebSite("http://secondlife.com/"); |
295 | } | 295 | } |
296 | 296 | ||
297 | 297 | ||
298 | 298 | ||
299 | // ******************************************************************** | 299 | // ******************************************************************** |
300 | // ******************************************************************** | 300 | // ******************************************************************** |
301 | // HippoGridManager | 301 | // HippoGridManager |
302 | // ******************************************************************** | 302 | // ******************************************************************** |
303 | // ******************************************************************** | 303 | // ******************************************************************** |
304 | 304 | ||
305 | 305 | ||
306 | // ******************************************************************** | 306 | // ******************************************************************** |
307 | // Initialize | 307 | // Initialize |
308 | 308 | ||
309 | HippoGridManager::HippoGridManager() : | 309 | HippoGridManager::HippoGridManager() : |
310 | mConnectedGrid(0), | 310 | mConnectedGrid(0), |
311 | mDefaultGridsVersion(0) | 311 | mDefaultGridsVersion(0) |
312 | { | 312 | { |
313 | } | 313 | } |
314 | 314 | ||
315 | HippoGridManager::~HippoGridManager() | 315 | HippoGridManager::~HippoGridManager() |
316 | { | 316 | { |
317 | cleanup(); | 317 | cleanup(); |
318 | } | 318 | } |
319 | 319 | ||
320 | 320 | ||
321 | void HippoGridManager::cleanup() | 321 | void HippoGridManager::cleanup() |
322 | { | 322 | { |
323 | std::map<std::string, HippoGridInfo*>::iterator it, end = mGridInfo.end(); | 323 | std::map<std::string, HippoGridInfo*>::iterator it, end = mGridInfo.end(); |
324 | for (it=mGridInfo.begin(); it != end; ++it) { | 324 | for (it=mGridInfo.begin(); it != end; ++it) { |
325 | delete it->second; | 325 | delete it->second; |
326 | } | 326 | } |
327 | mGridInfo.clear(); | 327 | mGridInfo.clear(); |
328 | } | 328 | } |
329 | 329 | ||
330 | 330 | ||
331 | void HippoGridManager::init() | 331 | void HippoGridManager::init() |
332 | { | 332 | { |
333 | HippoGridInfo::initFallback(); | 333 | HippoGridInfo::initFallback(); |
334 | loadFromFile(); | 334 | loadFromFile(); |
335 | 335 | ||
336 | // !!!### gSavedSettings.getControl("CmdLineLoginURI"); | 336 | // !!!### gSavedSettings.getControl("CmdLineLoginURI"); |
337 | // !!!### gSavedSettings.getString("CmdLineLoginPage"); | 337 | // !!!### gSavedSettings.getString("CmdLineLoginPage"); |
338 | // !!!### gSavedSettings.getString("CmdLineHelperURI"); | 338 | // !!!### gSavedSettings.getString("CmdLineHelperURI"); |
339 | // !!!### LLString::compareInsensitive(gGridInfo[grid_index].mLabel, grid_name.c_str())) | 339 | // !!!### LLString::compareInsensitive(gGridInfo[grid_index].mLabel, grid_name.c_str())) |
340 | } | 340 | } |
341 | 341 | ||
342 | 342 | ||
343 | void HippoGridManager::discardAndReload() | 343 | void HippoGridManager::discardAndReload() |
344 | { | 344 | { |
345 | cleanup(); | 345 | cleanup(); |
346 | loadFromFile(); | 346 | loadFromFile(); |
347 | } | 347 | } |
348 | 348 | ||
349 | 349 | ||
350 | // ******************************************************************** | 350 | // ******************************************************************** |
351 | // Public Access | 351 | // Public Access |
352 | 352 | ||
353 | HippoGridInfo *HippoGridManager::getGrid(const std::string &grid) const | 353 | HippoGridInfo *HippoGridManager::getGrid(const std::string &grid) const |
354 | { | 354 | { |
355 | std::map<std::string, HippoGridInfo*>::const_iterator it; | 355 | std::map<std::string, HippoGridInfo*>::const_iterator it; |
356 | it = mGridInfo.find(grid); | 356 | it = mGridInfo.find(grid); |
357 | if (it != mGridInfo.end()) { | 357 | if (it != mGridInfo.end()) { |
358 | return it->second; | 358 | return it->second; |
359 | } else { | 359 | } else { |
360 | return 0; | 360 | return 0; |
361 | } | 361 | } |
362 | } | 362 | } |
363 | 363 | ||
364 | 364 | ||
365 | HippoGridInfo *HippoGridManager::getCurrentGrid() const | 365 | HippoGridInfo *HippoGridManager::getCurrentGrid() const |
366 | { | 366 | { |
367 | HippoGridInfo *grid = getGrid(mCurrentGrid); | 367 | HippoGridInfo *grid = getGrid(mCurrentGrid); |
368 | if (grid) { | 368 | if (grid) { |
369 | return grid; | 369 | return grid; |
370 | } else { | 370 | } else { |
371 | return &HippoGridInfo::FALLBACK_GRIDINFO; | 371 | return &HippoGridInfo::FALLBACK_GRIDINFO; |
372 | } | 372 | } |
373 | } | 373 | } |
374 | 374 | ||
375 | 375 | ||
376 | void HippoGridManager::addGrid(HippoGridInfo *grid) | 376 | void HippoGridManager::addGrid(HippoGridInfo *grid) |
377 | { | 377 | { |
378 | if (!grid) return; | 378 | if (!grid) return; |
379 | const std::string &nick = grid->getGridNick(); | 379 | const std::string &nick = grid->getGridNick(); |
380 | if (nick == "") { | 380 | if (nick == "") { |
381 | llwarns << "Ignoring to try adding grid with empty nick." << llendl; | 381 | llwarns << "Ignoring to try adding grid with empty nick." << llendl; |
382 | delete grid; | 382 | delete grid; |
383 | return; | 383 | return; |
384 | } | 384 | } |
385 | if (mGridInfo.find(nick) != mGridInfo.end()) { | 385 | if (mGridInfo.find(nick) != mGridInfo.end()) { |
386 | llwarns << "Ignoring to try adding existing grid " << nick << '.' << llendl; | 386 | llwarns << "Ignoring to try adding existing grid " << nick << '.' << llendl; |
387 | delete grid; | 387 | delete grid; |
388 | return; | 388 | return; |
389 | } | 389 | } |
390 | mGridInfo[nick] = grid; | 390 | mGridInfo[nick] = grid; |
391 | } | 391 | } |
392 | 392 | ||
393 | 393 | ||
394 | void HippoGridManager::deleteGrid(const std::string &grid) | 394 | void HippoGridManager::deleteGrid(const std::string &grid) |
395 | { | 395 | { |
396 | GridIterator it = mGridInfo.find(grid); | 396 | GridIterator it = mGridInfo.find(grid); |
397 | if (it == mGridInfo.end()) { | 397 | if (it == mGridInfo.end()) { |
398 | llwarns << "Trying to delete non-existing grid " << grid << '.' << llendl; | 398 | llwarns << "Trying to delete non-existing grid " << grid << '.' << llendl; |
399 | return; | 399 | return; |
400 | } | 400 | } |
401 | mGridInfo.erase(it); | 401 | mGridInfo.erase(it); |
402 | llinfos << "Number of grids now: " << mGridInfo.size() << llendl; | 402 | llinfos << "Number of grids now: " << mGridInfo.size() << llendl; |
403 | if (mGridInfo.empty()) llinfos << "Grid info map is empty." << llendl; | 403 | if (mGridInfo.empty()) llinfos << "Grid info map is empty." << llendl; |
404 | if (grid == mDefaultGrid) | 404 | if (grid == mDefaultGrid) |
405 | setDefaultGrid(""); // sets first grid, if map not empty | 405 | setDefaultGrid(""); // sets first grid, if map not empty |
406 | if (grid == mCurrentGrid) | 406 | if (grid == mCurrentGrid) |
407 | mCurrentGrid = mDefaultGrid; | 407 | mCurrentGrid = mDefaultGrid; |
408 | } | 408 | } |
409 | 409 | ||
410 | 410 | ||
411 | void HippoGridManager::setDefaultGrid(const std::string &grid) | 411 | void HippoGridManager::setDefaultGrid(const std::string &grid) |
412 | { | 412 | { |
413 | GridIterator it = mGridInfo.find(grid); | 413 | GridIterator it = mGridInfo.find(grid); |
414 | if (it != mGridInfo.end()) { | 414 | if (it != mGridInfo.end()) { |
415 | mDefaultGrid = grid; | 415 | mDefaultGrid = grid; |
416 | } else if (mGridInfo.find("secondlife") != mGridInfo.end()) { | 416 | } else if (mGridInfo.find("secondlife") != mGridInfo.end()) { |
417 | mDefaultGrid = "secondlife"; | 417 | mDefaultGrid = "secondlife"; |
418 | } else if (!mGridInfo.empty()) { | 418 | } else if (!mGridInfo.empty()) { |
419 | mDefaultGrid = mGridInfo.begin()->first; | 419 | mDefaultGrid = mGridInfo.begin()->first; |
420 | } else { | 420 | } else { |
421 | mDefaultGrid = ""; | 421 | mDefaultGrid = ""; |
422 | } | 422 | } |
423 | } | 423 | } |
424 | 424 | ||
425 | 425 | ||
426 | void HippoGridManager::setCurrentGrid(const std::string &grid) | 426 | void HippoGridManager::setCurrentGrid(const std::string &grid) |
427 | { | 427 | { |
428 | GridIterator it = mGridInfo.find(grid); | 428 | GridIterator it = mGridInfo.find(grid); |
429 | if (it != mGridInfo.end()) { | 429 | if (it != mGridInfo.end()) { |
430 | mCurrentGrid = grid; | 430 | mCurrentGrid = grid; |
431 | } else if (!mGridInfo.empty()) { | 431 | } else if (!mGridInfo.empty()) { |
432 | llwarns << "Unknown grid '" << grid << "'. Setting to default grid." << llendl; | 432 | llwarns << "Unknown grid '" << grid << "'. Setting to default grid." << llendl; |
433 | mCurrentGrid = mDefaultGrid; | 433 | mCurrentGrid = mDefaultGrid; |
434 | } | 434 | } |
435 | } | 435 | } |
436 | 436 | ||
437 | 437 | ||
438 | // ******************************************************************** | 438 | // ******************************************************************** |
439 | // Persistent Store | 439 | // Persistent Store |
440 | 440 | ||
441 | void HippoGridManager::loadFromFile() | 441 | void HippoGridManager::loadFromFile() |
442 | { | 442 | { |
443 | mDefaultGridsVersion = 0; | 443 | mDefaultGridsVersion = 0; |
444 | // load user grid info | 444 | // load user grid info |
445 | parseFile(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "grid_info.xml"), false); | 445 | parseFile(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "grid_info.xml"), false); |
446 | // merge default grid info, if newer. Force load, if list of grids is empty. | 446 | // merge default grid info, if newer. Force load, if list of grids is empty. |
447 | parseFile(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "default_grids.xml"), !mGridInfo.empty()); | 447 | parseFile(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "default_grids.xml"), !mGridInfo.empty()); |
448 | // merge grid info from web site, if newer. Force load, if list of grids is empty. | 448 | // merge grid info from web site, if newer. Force load, if list of grids is empty. |
449 | if (gSavedSettings.getBOOL("CheckForGridUpdates")) | 449 | if (gSavedSettings.getBOOL("CheckForGridUpdates")) |
450 | parseUrl("http://opensim-viewer.sourceforge.net/db/grids.php", !mGridInfo.empty()); | 450 | parseUrl("http://opensim-viewer.sourceforge.net/db/grids.php", !mGridInfo.empty()); |
451 | 451 | ||
452 | setDefaultGrid(gSavedSettings.getString("DefaultGrid")); | 452 | setDefaultGrid(gSavedSettings.getString("DefaultGrid")); |
453 | setCurrentGrid(gSavedSettings.getString("CmdLineGridChoice")); | 453 | setCurrentGrid(gSavedSettings.getString("CmdLineGridChoice")); |
454 | } | 454 | } |
455 | 455 | ||
456 | 456 | ||
457 | void HippoGridManager::parseUrl(const char *url, bool mergeIfNewer) | 457 | void HippoGridManager::parseUrl(const char *url, bool mergeIfNewer) |
458 | { | 458 | { |
459 | llinfos << "Loading grid info from '" << url << "'." << llendl; | 459 | llinfos << "Loading grid info from '" << url << "'." << llendl; |
460 | 460 | ||
461 | // query update server | 461 | // query update server |
462 | std::string escaped_url = LLWeb::escapeURL(url); | 462 | std::string escaped_url = LLWeb::escapeURL(url); |
463 | LLSD response = LLHTTPClient::blockingGet(url); | 463 | LLSD response = LLHTTPClient::blockingGet(url); |
464 | 464 | ||
465 | // check response, return on error | 465 | // check response, return on error |
466 | S32 status = response["status"].asInteger(); | 466 | S32 status = response["status"].asInteger(); |
467 | if ((status != 200) || !response["body"].isArray()) { | 467 | if ((status != 200) || !response["body"].isArray()) { |
468 | llinfos << "GridInfo Update failed (" << status << "): " | 468 | llinfos << "GridInfo Update failed (" << status << "): " |
469 | << (response["body"].isString()? response["body"].asString(): "<unknown error>") | 469 | << (response["body"].isString()? response["body"].asString(): "<unknown error>") |
470 | << llendl; | 470 | << llendl; |
471 | return; | 471 | return; |
472 | } | 472 | } |
473 | 473 | ||
474 | LLSD gridInfo = response["body"]; | 474 | LLSD gridInfo = response["body"]; |
475 | parseData(gridInfo, mergeIfNewer); | 475 | parseData(gridInfo, mergeIfNewer); |
476 | } | 476 | } |
477 | 477 | ||
478 | void HippoGridManager::parseFile(const std::string &fileName, bool mergeIfNewer) | 478 | void HippoGridManager::parseFile(const std::string &fileName, bool mergeIfNewer) |
479 | { | 479 | { |
480 | llifstream infile; | 480 | llifstream infile; |
481 | infile.open(fileName.c_str()); | 481 | infile.open(fileName.c_str()); |
482 | if(!infile.is_open()) { | 482 | if(!infile.is_open()) { |
483 | llwarns << "Cannot find grid info file " << fileName << " to load." << llendl; | 483 | llwarns << "Cannot find grid info file " << fileName << " to load." << llendl; |
484 | return; | 484 | return; |
485 | } | 485 | } |
486 | 486 | ||
487 | LLSD gridInfo; | 487 | LLSD gridInfo; |
488 | if (LLSDSerialize::fromXML(gridInfo, infile) <= 0) { | 488 | if (LLSDSerialize::fromXML(gridInfo, infile) <= 0) { |
489 | llwarns << "Unable to parse grid info file " << fileName << '.' << llendl; | 489 | llwarns << "Unable to parse grid info file " << fileName << '.' << llendl; |
490 | return; | 490 | return; |
491 | } | 491 | } |
492 | 492 | ||
493 | llinfos << "Loading grid info file " << fileName << '.' << llendl; | 493 | llinfos << "Loading grid info file " << fileName << '.' << llendl; |
494 | parseData(gridInfo, mergeIfNewer); | 494 | parseData(gridInfo, mergeIfNewer); |
495 | } | 495 | } |
496 | 496 | ||
497 | 497 | ||
498 | void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer) | 498 | void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer) |
499 | { | 499 | { |
500 | if (mergeIfNewer) { | 500 | if (mergeIfNewer) { |
501 | LLSD::array_const_iterator it, end = gridInfo.endArray(); | 501 | LLSD::array_const_iterator it, end = gridInfo.endArray(); |
502 | for (it = gridInfo.beginArray(); it != end; ++it) { | 502 | for (it = gridInfo.beginArray(); it != end; ++it) { |
503 | LLSD gridMap = *it; | 503 | LLSD gridMap = *it; |
504 | if (gridMap.has("default_grids_version")) { | 504 | if (gridMap.has("default_grids_version")) { |
505 | int version = gridMap["default_grids_version"]; | 505 | int version = gridMap["default_grids_version"]; |
506 | if (version <= mDefaultGridsVersion) return; | 506 | if (version <= mDefaultGridsVersion) return; |
507 | else break; | 507 | else break; |
508 | } | 508 | } |
509 | } | 509 | } |
510 | if (it == end) { | 510 | if (it == end) { |
511 | llwarns << "Grid data has no version number." << llendl; | 511 | llwarns << "Grid data has no version number." << llendl; |
512 | return; | 512 | return; |
513 | } | 513 | } |
514 | } | 514 | } |
515 | 515 | ||
516 | llinfos << "Loading grid data." << llendl; | 516 | llinfos << "Loading grid data." << llendl; |
517 | 517 | ||
518 | LLSD::array_const_iterator it, end = gridInfo.endArray(); | 518 | LLSD::array_const_iterator it, end = gridInfo.endArray(); |
519 | for (it = gridInfo.beginArray(); it != end; ++it) { | 519 | for (it = gridInfo.beginArray(); it != end; ++it) { |
520 | LLSD gridMap = *it; | 520 | LLSD gridMap = *it; |
521 | if (gridMap.has("default_grids_version")) { | 521 | if (gridMap.has("default_grids_version")) { |
522 | mDefaultGridsVersion = gridMap["default_grids_version"]; | 522 | mDefaultGridsVersion = gridMap["default_grids_version"]; |
523 | } else if (gridMap.has("gridnick") && gridMap.has("loginuri")) { | 523 | } else if (gridMap.has("gridnick") && gridMap.has("loginuri")) { |
524 | std::string gridnick = gridMap["gridnick"]; | 524 | std::string gridnick = gridMap["gridnick"]; |
525 | HippoGridInfo *grid; | 525 | HippoGridInfo *grid; |
526 | GridIterator it = mGridInfo.find(gridnick); | 526 | GridIterator it = mGridInfo.find(gridnick); |
527 | bool newGrid = (it == mGridInfo.end()); | 527 | bool newGrid = (it == mGridInfo.end()); |
528 | if (newGrid) { | 528 | if (newGrid) { |
529 | // create new grid info | 529 | // create new grid info |
530 | grid = new HippoGridInfo(gridnick); | 530 | grid = new HippoGridInfo(gridnick); |
531 | } else { | 531 | } else { |
532 | // update existing grid info | 532 | // update existing grid info |
533 | grid = it->second; | 533 | grid = it->second; |
534 | } | 534 | } |
535 | grid->setLoginUri(gridMap["loginuri"]); | 535 | grid->setLoginUri(gridMap["loginuri"]); |
536 | if (gridMap.has("platform")) grid->setPlatform(gridMap["platform"]); | 536 | if (gridMap.has("platform")) grid->setPlatform(gridMap["platform"]); |
537 | if (gridMap.has("gridname")) grid->setGridName(gridMap["gridname"]); | 537 | if (gridMap.has("gridname")) grid->setGridName(gridMap["gridname"]); |
538 | if (gridMap.has("loginpage")) grid->setLoginPage(gridMap["loginpage"]); | 538 | if (gridMap.has("loginpage")) grid->setLoginPage(gridMap["loginpage"]); |
539 | if (gridMap.has("helperuri")) grid->setHelperUri(gridMap["helperuri"]); | 539 | if (gridMap.has("helperuri")) grid->setHelperUri(gridMap["helperuri"]); |
540 | if (gridMap.has("website")) grid->setWebSite(gridMap["website"]); | 540 | if (gridMap.has("website")) grid->setWebSite(gridMap["website"]); |
541 | if (gridMap.has("support")) grid->setSupportUrl(gridMap["support"]); | 541 | if (gridMap.has("support")) grid->setSupportUrl(gridMap["support"]); |
542 | if (gridMap.has("register")) grid->setRegisterUrl(gridMap["register"]); | 542 | if (gridMap.has("register")) grid->setRegisterUrl(gridMap["register"]); |
543 | if (gridMap.has("password")) grid->setPasswordUrl(gridMap["password"]); | 543 | if (gridMap.has("password")) grid->setPasswordUrl(gridMap["password"]); |
544 | //if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]); | 544 | //if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]); |
545 | if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]); | 545 | if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]); |
546 | if (gridMap.has("firstname")) grid->setFirstName(gridMap["firstname"]); | 546 | if (gridMap.has("firstname")) grid->setFirstName(gridMap["firstname"]); |
547 | if (gridMap.has("lastname")) grid->setLastName(gridMap["lastname"]); | 547 | if (gridMap.has("lastname")) grid->setLastName(gridMap["lastname"]); |
548 | if (gridMap.has("avatarpassword")) grid->setAvatarPassword(gridMap["avatarpassword"]); | 548 | if (gridMap.has("avatarpassword")) grid->setAvatarPassword(gridMap["avatarpassword"]); |
549 | if (newGrid) addGrid(grid); | 549 | if (newGrid) addGrid(grid); |
550 | } | 550 | } |
551 | } | 551 | } |
552 | } | 552 | } |
553 | 553 | ||
554 | 554 | ||
555 | void HippoGridManager::saveFile() | 555 | void HippoGridManager::saveFile() |
556 | { | 556 | { |
557 | // save default grid to client settings | 557 | // save default grid to client settings |
558 | gSavedSettings.setString("DefaultGrid", mDefaultGrid); | 558 | gSavedSettings.setString("DefaultGrid", mDefaultGrid); |
559 | 559 | ||
560 | // build LLSD | 560 | // build LLSD |
561 | LLSD gridInfo; | 561 | LLSD gridInfo; |
562 | gridInfo[0]["default_grids_version"] = mDefaultGridsVersion; | 562 | gridInfo[0]["default_grids_version"] = mDefaultGridsVersion; |
563 | 563 | ||
564 | // add grids | 564 | // add grids |
565 | S32 i = 1; | 565 | S32 i = 1; |
566 | GridIterator it, end = mGridInfo.end(); | 566 | GridIterator it, end = mGridInfo.end(); |
567 | for (it = mGridInfo.begin(); it != end; ++it, i++) { | 567 | for (it = mGridInfo.begin(); it != end; ++it, i++) { |
568 | HippoGridInfo *grid = it->second; | 568 | HippoGridInfo *grid = it->second; |
569 | gridInfo[i]["gridnick"] = grid->getGridNick(); | 569 | gridInfo[i]["gridnick"] = grid->getGridNick(); |
570 | gridInfo[i]["platform"] = HippoGridInfo::getPlatformString(grid->getPlatform()); | 570 | gridInfo[i]["platform"] = HippoGridInfo::getPlatformString(grid->getPlatform()); |
571 | gridInfo[i]["gridname"] = grid->getGridName(); | 571 | gridInfo[i]["gridname"] = grid->getGridName(); |
572 | gridInfo[i]["loginuri"] = grid->getLoginUri(); | 572 | gridInfo[i]["loginuri"] = grid->getLoginUri(); |
573 | gridInfo[i]["loginpage"] = grid->getLoginPage(); | 573 | gridInfo[i]["loginpage"] = grid->getLoginPage(); |
574 | gridInfo[i]["helperuri"] = grid->getHelperUri(); | 574 | gridInfo[i]["helperuri"] = grid->getHelperUri(); |
575 | gridInfo[i]["website"] = grid->getWebSite(); | 575 | gridInfo[i]["website"] = grid->getWebSite(); |
576 | gridInfo[i]["support"] = grid->getSupportUrl(); | 576 | gridInfo[i]["support"] = grid->getSupportUrl(); |
577 | gridInfo[i]["register"] = grid->getRegisterUrl(); | 577 | gridInfo[i]["register"] = grid->getRegisterUrl(); |
578 | gridInfo[i]["firstname"] = grid->getFirstName(); | 578 | gridInfo[i]["firstname"] = grid->getFirstName(); |
579 | gridInfo[i]["lastname"] = grid->getLastName(); | 579 | gridInfo[i]["lastname"] = grid->getLastName(); |
580 | gridInfo[i]["avatarpassword"] = grid->getAvatarPassword(); | 580 | gridInfo[i]["avatarpassword"] = grid->getAvatarPassword(); |
581 | 581 | ||
582 | //gridInfo[i]["search"] = grid->getSearchUrl(); | 582 | //gridInfo[i]["search"] = grid->getSearchUrl(); |
583 | gridInfo[i]["render_compat"] = grid->isRenderCompat(); | 583 | gridInfo[i]["render_compat"] = grid->isRenderCompat(); |
584 | } | 584 | } |
585 | 585 | ||
586 | // write client grid info file | 586 | // write client grid info file |
587 | std::string fileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "grid_info.xml"); | 587 | std::string fileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "grid_info.xml"); |
588 | llofstream file; | 588 | llofstream file; |
589 | file.open(fileName.c_str()); | 589 | file.open(fileName.c_str()); |
590 | if (file.is_open()) { | 590 | if (file.is_open()) { |
591 | LLSDSerialize::toPrettyXML(gridInfo, file); | 591 | LLSDSerialize::toPrettyXML(gridInfo, file); |
592 | file.close(); | 592 | file.close(); |
593 | llinfos << "Saved grids to " << fileName << llendl; | 593 | llinfos << "Saved grids to " << fileName << llendl; |
594 | } else { | 594 | } else { |
595 | llerrs << "Unable to open grid info file: " << fileName << llendl; | 595 | llerrs << "Unable to open grid info file: " << fileName << llendl; |
596 | } | 596 | } |
597 | } | 597 | } |