diff options
author | Melanie | 2010-10-21 17:09:42 +0100 |
---|---|---|
committer | Melanie | 2010-10-21 17:09:42 +0100 |
commit | 08e14d653e826b72300215dba8816abcc6a9e6ec (patch) | |
tree | 44aadaad5d7c3bde10b1ec6452e1e507d4df047e /OpenSim/Services/Connectors/SimianGrid | |
parent | Make SImStatsReporter pick ObjectCapacity striaght out of region info (diff) | |
parent | Major refactoring of appearance handling. (diff) | |
download | opensim-SC-08e14d653e826b72300215dba8816abcc6a9e6ec.zip opensim-SC-08e14d653e826b72300215dba8816abcc6a9e6ec.tar.gz opensim-SC-08e14d653e826b72300215dba8816abcc6a9e6ec.tar.bz2 opensim-SC-08e14d653e826b72300215dba8816abcc6a9e6ec.tar.xz |
Merge branch 'dev-appearance' of git://github.com/cmickeyb/opensim into dev-appearance
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs | 82 |
1 files changed, 81 insertions, 1 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 4d0d53e..ea9b4b4 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs | |||
@@ -28,6 +28,9 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Collections.Specialized; | 30 | using System.Collections.Specialized; |
31 | // DEBUG ON | ||
32 | using System.Diagnostics; | ||
33 | // DEBUG OFF | ||
31 | using System.Reflection; | 34 | using System.Reflection; |
32 | using log4net; | 35 | using log4net; |
33 | using Mono.Addins; | 36 | using Mono.Addins; |
@@ -106,6 +109,80 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
106 | 109 | ||
107 | #region IAvatarService | 110 | #region IAvatarService |
108 | 111 | ||
112 | // <summary> | ||
113 | // Retrieves the LLPackedAppearance field from user data and unpacks | ||
114 | // it into an AvatarAppearance structure | ||
115 | // </summary> | ||
116 | // <param name="userID"></param> | ||
117 | public AvatarAppearance GetAppearance(UUID userID) | ||
118 | { | ||
119 | NameValueCollection requestArgs = new NameValueCollection | ||
120 | { | ||
121 | { "RequestMethod", "GetUser" }, | ||
122 | { "UserID", userID.ToString() } | ||
123 | }; | ||
124 | |||
125 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | ||
126 | if (response["Success"].AsBoolean()) | ||
127 | { | ||
128 | OSDMap map = null; | ||
129 | try { map = OSDParser.DeserializeJson(response["LLPackedAppearance"].AsString()) as OSDMap; } | ||
130 | catch { } | ||
131 | |||
132 | if (map != null) | ||
133 | { | ||
134 | AvatarAppearance appearance = new AvatarAppearance(map); | ||
135 | // DEBUG ON | ||
136 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR] retrieved appearance for {0}:\n{1}",userID,appearance.ToString()); | ||
137 | // DEBUG OFF | ||
138 | return appearance; | ||
139 | } | ||
140 | |||
141 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to decode appearance for {0}",userID); | ||
142 | return null; | ||
143 | } | ||
144 | |||
145 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to get appearance for {0}: {1}", | ||
146 | userID,response["Message"].AsString()); | ||
147 | return null; | ||
148 | } | ||
149 | |||
150 | // <summary> | ||
151 | // </summary> | ||
152 | // <param name=""></param> | ||
153 | public bool SetAppearance(UUID userID, AvatarAppearance appearance) | ||
154 | { | ||
155 | OSDMap map = appearance.Pack(); | ||
156 | if (map == null) | ||
157 | { | ||
158 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to encode appearance for {0}",userID); | ||
159 | return false; | ||
160 | } | ||
161 | |||
162 | // DEBUG ON | ||
163 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR] save appearance for {0}",userID); | ||
164 | // DEBUG OFF | ||
165 | |||
166 | NameValueCollection requestArgs = new NameValueCollection | ||
167 | { | ||
168 | { "RequestMethod", "AddUserData" }, | ||
169 | { "UserID", userID.ToString() }, | ||
170 | { "LLPackedAppearance", OSDParser.SerializeJsonString(map) } | ||
171 | }; | ||
172 | |||
173 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | ||
174 | bool success = response["Success"].AsBoolean(); | ||
175 | |||
176 | if (! success) | ||
177 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to save appearance for {0}: {1}", | ||
178 | userID,response["Message"].AsString()); | ||
179 | |||
180 | return success; | ||
181 | } | ||
182 | |||
183 | // <summary> | ||
184 | // </summary> | ||
185 | // <param name=""></param> | ||
109 | public AvatarData GetAvatar(UUID userID) | 186 | public AvatarData GetAvatar(UUID userID) |
110 | { | 187 | { |
111 | NameValueCollection requestArgs = new NameValueCollection | 188 | NameValueCollection requestArgs = new NameValueCollection |
@@ -154,7 +231,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
154 | foreach (KeyValuePair<string, OSD> kvp in map) | 231 | foreach (KeyValuePair<string, OSD> kvp in map) |
155 | avatar.Data[kvp.Key] = kvp.Value.AsString(); | 232 | avatar.Data[kvp.Key] = kvp.Value.AsString(); |
156 | } | 233 | } |
157 | 234 | ||
158 | return avatar; | 235 | return avatar; |
159 | } | 236 | } |
160 | else | 237 | else |
@@ -173,6 +250,9 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
173 | return null; | 250 | return null; |
174 | } | 251 | } |
175 | 252 | ||
253 | // <summary> | ||
254 | // </summary> | ||
255 | // <param name=""></param> | ||
176 | public bool SetAvatar(UUID userID, AvatarData avatar) | 256 | public bool SetAvatar(UUID userID, AvatarData avatar) |
177 | { | 257 | { |
178 | m_log.Debug("[SIMIAN AVATAR CONNECTOR]: SetAvatar called for " + userID); | 258 | m_log.Debug("[SIMIAN AVATAR CONNECTOR]: SetAvatar called for " + userID); |