aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/AvatarService/AvatarService.cs14
-rw-r--r--OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs12
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs82
-rw-r--r--OpenSim/Services/Interfaces/IAvatarService.cs32
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs10
5 files changed, 137 insertions, 13 deletions
diff --git a/OpenSim/Services/AvatarService/AvatarService.cs b/OpenSim/Services/AvatarService/AvatarService.cs
index 19e662c..a8ad413 100644
--- a/OpenSim/Services/AvatarService/AvatarService.cs
+++ b/OpenSim/Services/AvatarService/AvatarService.cs
@@ -51,6 +51,20 @@ namespace OpenSim.Services.AvatarService
51 m_log.Debug("[AVATAR SERVICE]: Starting avatar service"); 51 m_log.Debug("[AVATAR SERVICE]: Starting avatar service");
52 } 52 }
53 53
54 // Get|SetAppearance should preserve existing semantics
55 // until AvatarData can be removed completely
56 public AvatarAppearance GetAppearance(UUID principalID)
57 {
58 AvatarData avatar = GetAvatar(principalID);
59 return avatar.ToAvatarAppearance(principalID);
60 }
61
62 public bool SetAppearance(UUID principalID, AvatarAppearance appearance)
63 {
64 AvatarData avatar = new AvatarData(appearance);
65 return SetAvatar(principalID,avatar);
66 }
67
54 public AvatarData GetAvatar(UUID principalID) 68 public AvatarData GetAvatar(UUID principalID)
55 { 69 {
56 AvatarBaseData[] av = m_Database.Get("PrincipalID", principalID.ToString()); 70 AvatarBaseData[] av = m_Database.Get("PrincipalID", principalID.ToString());
diff --git a/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs b/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs
index 96c05a9..1cd6bf8 100644
--- a/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs
@@ -87,6 +87,18 @@ namespace OpenSim.Services.Connectors
87 87
88 #region IAvatarService 88 #region IAvatarService
89 89
90 public AvatarAppearance GetAppearance(UUID userID)
91 {
92 AvatarData avatar = GetAvatar(userID);
93 return avatar.ToAvatarAppearance(userID);
94 }
95
96 public bool SetAppearance(UUID userID, AvatarAppearance appearance)
97 {
98 AvatarData avatar = new AvatarData(appearance);
99 return SetAvatar(userID,avatar);
100 }
101
90 public AvatarData GetAvatar(UUID userID) 102 public AvatarData GetAvatar(UUID userID)
91 { 103 {
92 Dictionary<string, object> sendData = new Dictionary<string, object>(); 104 Dictionary<string, object> sendData = new Dictionary<string, object>();
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 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31// DEBUG ON
32using System.Diagnostics;
33// DEBUG OFF
31using System.Reflection; 34using System.Reflection;
32using log4net; 35using log4net;
33using Mono.Addins; 36using 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);
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs
index de3bcf9..93b977b 100644
--- a/OpenSim/Services/Interfaces/IAvatarService.cs
+++ b/OpenSim/Services/Interfaces/IAvatarService.cs
@@ -42,6 +42,21 @@ namespace OpenSim.Services.Interfaces
42 /// </summary> 42 /// </summary>
43 /// <param name="userID"></param> 43 /// <param name="userID"></param>
44 /// <returns></returns> 44 /// <returns></returns>
45 AvatarAppearance GetAppearance(UUID userID);
46
47 /// <summary>
48 /// Called by everyone who can change the avatar data (so, regions)
49 /// </summary>
50 /// <param name="userID"></param>
51 /// <param name="appearance"></param>
52 /// <returns></returns>
53 bool SetAppearance(UUID userID, AvatarAppearance appearance);
54
55 /// <summary>
56 /// Called by the login service
57 /// </summary>
58 /// <param name="userID"></param>
59 /// <returns></returns>
45 AvatarData GetAvatar(UUID userID); 60 AvatarData GetAvatar(UUID userID);
46 61
47 /// <summary> 62 /// <summary>
@@ -217,23 +232,26 @@ namespace OpenSim.Services.Interfaces
217 foreach (KeyValuePair<string, string> _kvp in Data) 232 foreach (KeyValuePair<string, string> _kvp in Data)
218 if (_kvp.Key.StartsWith("_ap_")) 233 if (_kvp.Key.StartsWith("_ap_"))
219 attchs[_kvp.Key] = _kvp.Value; 234 attchs[_kvp.Key] = _kvp.Value;
220 Hashtable aaAttachs = new Hashtable(); 235
221 foreach (KeyValuePair<string, string> _kvp in attchs) 236 foreach (KeyValuePair<string, string> _kvp in attchs)
222 { 237 {
223 string pointStr = _kvp.Key.Substring(4); 238 string pointStr = _kvp.Key.Substring(4);
224 int point = 0; 239 int point = 0;
225 if (!Int32.TryParse(pointStr, out point)) 240 if (!Int32.TryParse(pointStr, out point))
226 continue; 241 continue;
227 Hashtable tmp = new Hashtable(); 242
228 UUID uuid = UUID.Zero; 243 UUID uuid = UUID.Zero;
229 UUID.TryParse(_kvp.Value, out uuid); 244 UUID.TryParse(_kvp.Value, out uuid);
230 tmp["item"] = uuid; 245
231 tmp["asset"] = UUID.Zero.ToString(); 246 appearance.SetAttachment(point,uuid,UUID.Zero);
232 aaAttachs[point] = tmp;
233 } 247 }
234 appearance.SetAttachments(aaAttachs);
235 } 248 }
236 catch { } 249 catch
250 {
251 // We really should report something here, returning null
252 // will at least break the wrapper
253 return null;
254 }
237 255
238 return appearance; 256 return appearance;
239 } 257 }
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 127c4b2..a06476e 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -330,10 +330,10 @@ namespace OpenSim.Services.LLLoginService
330 // 330 //
331 // Get the avatar 331 // Get the avatar
332 // 332 //
333 AvatarData avatar = null; 333 AvatarAppearance avatar = null;
334 if (m_AvatarService != null) 334 if (m_AvatarService != null)
335 { 335 {
336 avatar = m_AvatarService.GetAvatar(account.PrincipalID); 336 avatar = m_AvatarService.GetAppearance(account.PrincipalID);
337 } 337 }
338 338
339 // 339 //
@@ -601,7 +601,7 @@ namespace OpenSim.Services.LLLoginService
601 } 601 }
602 } 602 }
603 603
604 protected AgentCircuitData LaunchAgentAtGrid(GridRegion gatekeeper, GridRegion destination, UserAccount account, AvatarData avatar, 604 protected AgentCircuitData LaunchAgentAtGrid(GridRegion gatekeeper, GridRegion destination, UserAccount account, AvatarAppearance avatar,
605 UUID session, UUID secureSession, Vector3 position, string currentWhere, string viewer, string channel, string mac, string id0, 605 UUID session, UUID secureSession, Vector3 position, string currentWhere, string viewer, string channel, string mac, string id0,
606 IPEndPoint clientIP, out string where, out string reason, out GridRegion dest) 606 IPEndPoint clientIP, out string where, out string reason, out GridRegion dest)
607 { 607 {
@@ -697,14 +697,14 @@ namespace OpenSim.Services.LLLoginService
697 } 697 }
698 698
699 private AgentCircuitData MakeAgent(GridRegion region, UserAccount account, 699 private AgentCircuitData MakeAgent(GridRegion region, UserAccount account,
700 AvatarData avatar, UUID session, UUID secureSession, uint circuit, Vector3 position, 700 AvatarAppearance avatar, UUID session, UUID secureSession, uint circuit, Vector3 position,
701 string ipaddress, string viewer, string channel, string mac, string id0) 701 string ipaddress, string viewer, string channel, string mac, string id0)
702 { 702 {
703 AgentCircuitData aCircuit = new AgentCircuitData(); 703 AgentCircuitData aCircuit = new AgentCircuitData();
704 704
705 aCircuit.AgentID = account.PrincipalID; 705 aCircuit.AgentID = account.PrincipalID;
706 if (avatar != null) 706 if (avatar != null)
707 aCircuit.Appearance = avatar.ToAvatarAppearance(account.PrincipalID); 707 aCircuit.Appearance = new AvatarAppearance(avatar);
708 else 708 else
709 aCircuit.Appearance = new AvatarAppearance(account.PrincipalID); 709 aCircuit.Appearance = new AvatarAppearance(account.PrincipalID);
710 710