diff options
author | Armin Weatherwax | 2009-06-26 09:39:58 +0200 |
---|---|---|
committer | Armin Weatherwax | 2009-07-11 13:42:35 +0200 |
commit | 7067b31a6114089217e482bfecc58fd56bed4272 (patch) | |
tree | e0bb99a42c64cdb75e9ca15a38bc1171377c7739 /linden/indra/newview/hippoGridManager.h | |
parent | Updated URL for Mac OpenAL libs package. (diff) | |
download | meta-impy-7067b31a6114089217e482bfecc58fd56bed4272.zip meta-impy-7067b31a6114089217e482bfecc58fd56bed4272.tar.gz meta-impy-7067b31a6114089217e482bfecc58fd56bed4272.tar.bz2 meta-impy-7067b31a6114089217e482bfecc58fd56bed4272.tar.xz |
BROKEN logoff/relog crashing inconsistently on various startup states.
Diffstat (limited to 'linden/indra/newview/hippoGridManager.h')
-rw-r--r-- | linden/indra/newview/hippoGridManager.h | 171 |
1 files changed, 171 insertions, 0 deletions
diff --git a/linden/indra/newview/hippoGridManager.h b/linden/indra/newview/hippoGridManager.h new file mode 100644 index 0000000..933a944 --- /dev/null +++ b/linden/indra/newview/hippoGridManager.h | |||
@@ -0,0 +1,171 @@ | |||
1 | #ifndef __HIPPO_GRID_MANAGER_H__ | ||
2 | #define __HIPPO_GRID_MANAGER_H__ | ||
3 | |||
4 | |||
5 | #include <map> | ||
6 | #include <string> | ||
7 | |||
8 | #ifndef XML_STATIC | ||
9 | #define XML_STATIC | ||
10 | #endif | ||
11 | #include <expat/expat.h> | ||
12 | |||
13 | |||
14 | class LLSD; | ||
15 | |||
16 | |||
17 | class HippoGridInfo | ||
18 | { | ||
19 | public: | ||
20 | enum Platform { | ||
21 | PLATFORM_OTHER = 0, | ||
22 | PLATFORM_OPENSIM, | ||
23 | PLATFORM_SECONDLIFE, | ||
24 | PLATFORM_LAST | ||
25 | }; | ||
26 | enum SearchType { | ||
27 | SEARCH_ALL_EMPTY, | ||
28 | SEARCH_ALL_QUERY, | ||
29 | SEARCH_ALL_TEMPLATE | ||
30 | }; | ||
31 | |||
32 | explicit HippoGridInfo(const std::string &gridNick); | ||
33 | |||
34 | Platform getPlatform() const { return mPlatform; } | ||
35 | const std::string &getGridNick() const { return mGridNick; } | ||
36 | const std::string &getGridName() const { return mGridName; } | ||
37 | const std::string &getLoginUri() const { return mLoginUri; } | ||
38 | const std::string &getLoginPage() const { return mLoginPage; } | ||
39 | const std::string &getHelperUri() const { return mHelperUri; } | ||
40 | const std::string &getWebSite() const { return mWebSite; } | ||
41 | const std::string &getSupportUrl() const { return mSupportUrl; } | ||
42 | const std::string &getRegisterUrl() const { return mRegisterUrl; } | ||
43 | const std::string &getPasswordUrl() const { return mPasswordUrl; } | ||
44 | const std::string &getSearchUrl() const { return mSearchUrl; } | ||
45 | const std::string &getFirstName() const { return mFirstName; } | ||
46 | const std::string &getLastName() const { return mLastName; } | ||
47 | const std::string &getAvatarPassword() const { return mAvatarPassword; } | ||
48 | std::string getSearchUrl(SearchType ty) const; | ||
49 | bool isRenderCompat() const { return mRenderCompat; } | ||
50 | |||
51 | const std::string &getCurrencySymbol() const { return mCurrencySymbol; } | ||
52 | const std::string &getRealCurrencySymbol() const { return mRealCurrencySymbol; } | ||
53 | std::string getUploadFee() const; | ||
54 | std::string getGroupCreationFee() const; | ||
55 | std::string getDirectoryFee() const; | ||
56 | |||
57 | bool isOpenSimulator() const { return (mPlatform == PLATFORM_OPENSIM ); } | ||
58 | bool isSecondLife() const { return (mPlatform == PLATFORM_SECONDLIFE); } | ||
59 | |||
60 | void setPlatform (const std::string &platform); | ||
61 | void setPlatform (Platform platform); | ||
62 | void setGridName (const std::string &gridName) { mGridName = gridName; } | ||
63 | void setLoginUri (const std::string &loginUri) { mLoginUri = loginUri; cleanUpUri(mLoginUri); } | ||
64 | void setLoginPage(const std::string &loginPage) { mLoginPage = loginPage; } | ||
65 | void setHelperUri(const std::string &helperUri) { mHelperUri = helperUri; cleanUpUri(mHelperUri); } | ||
66 | void setWebSite (const std::string &website) { mWebSite = website; } | ||
67 | void setSupportUrl(const std::string &url) { mSupportUrl = url; } | ||
68 | void setRegisterUrl(const std::string &url) { mRegisterUrl = url; } | ||
69 | void setPasswordUrl(const std::string &url) { mPasswordUrl = url; } | ||
70 | void setSearchUrl(const std::string &url) { mSearchUrl = url; } | ||
71 | void setRenderCompat(bool compat) { mRenderCompat = compat; } | ||
72 | void setFirstName(const std::string &firstName) { mFirstName = firstName; } //aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | ||
73 | void setLastName(const std::string &lastName) { mLastName = lastName; } | ||
74 | void setAvatarPassword(const std::string &avatarPassword) { mAvatarPassword = avatarPassword; } | ||
75 | |||
76 | void setCurrencySymbol(const std::string &sym) { mCurrencySymbol = sym.substr(0, 3); } | ||
77 | void setRealCurrencySymbol(const std::string &sym) { mRealCurrencySymbol = sym.substr(0, 3); } | ||
78 | void setDirectoryFee(int fee) { mDirectoryFee = fee; } | ||
79 | |||
80 | bool retrieveGridInfo(); | ||
81 | |||
82 | static const char *getPlatformString(Platform platform); | ||
83 | static void cleanUpGridNick(std::string &gridnick); | ||
84 | |||
85 | static HippoGridInfo FALLBACK_GRIDINFO; | ||
86 | static void initFallback(); | ||
87 | |||
88 | private: | ||
89 | Platform mPlatform; | ||
90 | std::string mGridNick; | ||
91 | std::string mGridName; | ||
92 | std::string mLoginUri; | ||
93 | std::string mLoginPage; | ||
94 | std::string mHelperUri; | ||
95 | std::string mWebSite; | ||
96 | std::string mSupportUrl; | ||
97 | std::string mRegisterUrl; | ||
98 | std::string mPasswordUrl; | ||
99 | std::string mSearchUrl; | ||
100 | std::string mFirstName; | ||
101 | std::string mLastName; | ||
102 | std::string mAvatarPassword; | ||
103 | bool mRenderCompat; | ||
104 | |||
105 | std::string mCurrencySymbol; | ||
106 | std::string mRealCurrencySymbol; | ||
107 | int mDirectoryFee; | ||
108 | |||
109 | // for parsing grid info XML | ||
110 | enum XmlState { | ||
111 | XML_VOID, XML_GRIDNICK, XML_PLATFORM, XML_GRIDNAME, | ||
112 | XML_LOGINURI, XML_LOGINPAGE, XML_HELPERURI, | ||
113 | XML_WEBSITE, XML_SUPPORT, XML_REGISTER, XML_PASSWORD, XML_SEARCH | ||
114 | }; | ||
115 | XmlState mXmlState; | ||
116 | |||
117 | static void cleanUpUri(std::string &uri); | ||
118 | void formatFee(std::string &fee, int cost, bool showFree) const; | ||
119 | |||
120 | static void onXmlElementStart(void *userData, const XML_Char *name, const XML_Char **atts); | ||
121 | static void onXmlElementEnd(void *userData, const XML_Char *name); | ||
122 | static void onXmlCharacterData(void *userData, const XML_Char *s, int len); | ||
123 | }; | ||
124 | |||
125 | |||
126 | class HippoGridManager | ||
127 | { | ||
128 | public: | ||
129 | HippoGridManager(); | ||
130 | ~HippoGridManager(); | ||
131 | |||
132 | void init(); | ||
133 | void saveFile(); | ||
134 | void discardAndReload(); | ||
135 | |||
136 | HippoGridInfo *getGrid(const std::string &grid) const; | ||
137 | HippoGridInfo *getConnectedGrid() const { return (mConnectedGrid)? mConnectedGrid: getCurrentGrid(); } | ||
138 | HippoGridInfo *getCurrentGrid() const; | ||
139 | const std::string &getDefaultGridNick() const { return mDefaultGrid; } | ||
140 | const std::string &getCurrentGridNick() const { return mCurrentGrid; } | ||
141 | |||
142 | void setDefaultGrid(const std::string &grid); | ||
143 | void setCurrentGrid(const std::string &grid); | ||
144 | void setCurrentGridAsConnected() { mConnectedGrid = getCurrentGrid(); } | ||
145 | |||
146 | void addGrid(HippoGridInfo *grid); | ||
147 | void deleteGrid(const std::string &grid); | ||
148 | |||
149 | typedef std::map<std::string, HippoGridInfo*>::iterator GridIterator; | ||
150 | GridIterator beginGrid() { return mGridInfo.begin(); } | ||
151 | GridIterator endGrid() { return mGridInfo.end(); } | ||
152 | |||
153 | private: | ||
154 | std::map<std::string, HippoGridInfo*> mGridInfo; | ||
155 | std::string mDefaultGrid; | ||
156 | std::string mCurrentGrid; | ||
157 | HippoGridInfo *mConnectedGrid; | ||
158 | int mDefaultGridsVersion; | ||
159 | |||
160 | void cleanup(); | ||
161 | void loadFromFile(); | ||
162 | void parseFile(const std::string &fileName, bool mergeIfNewer); | ||
163 | void parseUrl(const char *url, bool mergeIfNewer); | ||
164 | void parseData(LLSD &gridInfo, bool mergeIfNewer); | ||
165 | }; | ||
166 | |||
167 | |||
168 | extern HippoGridManager *gHippoGridManager; | ||
169 | |||
170 | |||
171 | #endif | ||