diff options
Diffstat (limited to 'linden/indra/newview/authentication_model.cpp')
-rw-r--r-- | linden/indra/newview/authentication_model.cpp | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/linden/indra/newview/authentication_model.cpp b/linden/indra/newview/authentication_model.cpp deleted file mode 100644 index 763ab4a..0000000 --- a/linden/indra/newview/authentication_model.cpp +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | /* | ||
2 | * authentication_model.cpp | ||
3 | * SecondLife | ||
4 | * | ||
5 | * Created by RMS on 7/17/08. | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #include "llviewerprecompiledheaders.h" | ||
10 | |||
11 | #include "lldir.h" | ||
12 | #include "llfile.h" | ||
13 | #include "llsdserialize.h" | ||
14 | #include "authentication_model.h" | ||
15 | |||
16 | AuthenticationModel::AuthenticationModel() | ||
17 | { | ||
18 | loadPersistentData(); | ||
19 | } | ||
20 | |||
21 | AuthenticationModel::~AuthenticationModel() | ||
22 | { | ||
23 | savePersistentData(); | ||
24 | } | ||
25 | |||
26 | void AuthenticationModel::loadPersistentData() | ||
27 | { | ||
28 | std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, | ||
29 | "cross_grid_authentication.xml"); | ||
30 | LLSD auth_llsd; | ||
31 | llifstream file; | ||
32 | file.open(filename); | ||
33 | if(file.is_open()) | ||
34 | LLSDSerialize::fromXML(mAuthLLSD, file); | ||
35 | } | ||
36 | |||
37 | void AuthenticationModel::savePersistentData() | ||
38 | { | ||
39 | std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, | ||
40 | "cross_grid_authentication.xml"); | ||
41 | llofstream ofile; | ||
42 | ofile.open(filename); | ||
43 | LLSDSerialize::toPrettyXML(mAuthLLSD, ofile); | ||
44 | } | ||
45 | |||
46 | void AuthenticationModel::revert() | ||
47 | { | ||
48 | loadPersistentData(); | ||
49 | } | ||
50 | |||
51 | AuthenticationModel::connection_t AuthenticationModel::subscribeToModelUpdates | ||
52 | (event_t::slot_function_type subscriber) | ||
53 | { | ||
54 | return mEventUpdate.connect(subscriber); | ||
55 | } | ||
56 | |||
57 | void AuthenticationModel::unsubscribe(connection_t subscriber) | ||
58 | { | ||
59 | subscriber.disconnect(); | ||
60 | } | ||
61 | |||
62 | /* setters */ | ||
63 | void AuthenticationModel::addAccount(const std::string &grid, const std::string &accountName, | ||
64 | const std::string &accountPassword) | ||
65 | { | ||
66 | mAuthLLSD[grid][accountName] = LLSD::LLSD(accountPassword); | ||
67 | mEventUpdate(); | ||
68 | } | ||
69 | |||
70 | void AuthenticationModel::removeAccount(const std::string &grid, const std::string &accountName) | ||
71 | { | ||
72 | mAuthLLSD[grid].erase(accountName); | ||
73 | mEventUpdate(); | ||
74 | } | ||
75 | |||
76 | void AuthenticationModel::changePassword(const std::string &grid, const std::string &accountName, | ||
77 | const std::string &newPassword) | ||
78 | { | ||
79 | mAuthLLSD[grid][accountName] = newPassword; | ||
80 | // no event necessary: passwords aren't displayed in any view | ||
81 | } | ||
82 | |||
83 | /* getters */ | ||
84 | |||
85 | void AuthenticationModel::getAllAccountNames(std::list<std::string> &names) | ||
86 | { | ||
87 | // TODO: implement this for account management | ||
88 | } | ||
89 | |||
90 | void AuthenticationModel::getAccountNames(const std::string &grid, std::set<std::string> &names) | ||
91 | { | ||
92 | if(!mAuthLLSD.has(grid)) | ||
93 | return; | ||
94 | |||
95 | for(LLSD::map_const_iterator it = mAuthLLSD[grid].beginMap(); | ||
96 | it != mAuthLLSD[grid].endMap(); ++it) | ||
97 | { | ||
98 | names.insert(it->first); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | void AuthenticationModel::getPassword(const std::string &grid, const std::string &accountName, | ||
103 | std::string &password) | ||
104 | { | ||
105 | password = mAuthLLSD[grid][accountName].asString(); | ||
106 | } | ||
107 | |||
108 | void AuthenticationModel::requestUpdate() | ||
109 | { | ||
110 | mEventUpdate(); | ||
111 | } | ||