aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-02 00:54:50 +0000
committerTeravus Ovares2008-01-02 00:54:50 +0000
commit3738bc88999d4cf8060fa2535cb264e0cddcb8c7 (patch)
tree3e113c52cc51f7f8c7a43a938afcd27d6edb2579
parentFixed nant compile problem (diff)
downloadopensim-SC-3738bc88999d4cf8060fa2535cb264e0cddcb8c7.zip
opensim-SC-3738bc88999d4cf8060fa2535cb264e0cddcb8c7.tar.gz
opensim-SC-3738bc88999d4cf8060fa2535cb264e0cddcb8c7.tar.bz2
opensim-SC-3738bc88999d4cf8060fa2535cb264e0cddcb8c7.tar.xz
* Updates UserServer
* Updates OSG1UserServices * Friends list is now persistent in grid mode. * You can add, new friends and remove them
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs4
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs2
-rw-r--r--OpenSim/Grid/UserServer/Main.cs6
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs98
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs175
5 files changed, 277 insertions, 8 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index a5e6da4..7e2d4f0 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -205,7 +205,6 @@ namespace OpenSim.Framework.Data.MySQL
205 MainLog.Instance.Error(e.ToString()); 205 MainLog.Instance.Error(e.ToString());
206 return; 206 return;
207 } 207 }
208 MainLog.Instance.Verbose("FRIEND", "Stub AddNewUserFriend called");
209 } 208 }
210 209
211 public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) 210 public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
@@ -241,7 +240,6 @@ namespace OpenSim.Framework.Data.MySQL
241 MainLog.Instance.Error(e.ToString()); 240 MainLog.Instance.Error(e.ToString());
242 return; 241 return;
243 } 242 }
244 MainLog.Instance.Verbose("FRIEND", "Stub RemoveUserFriend called");
245 } 243 }
246 public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) 244 public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
247 { 245 {
@@ -271,7 +269,6 @@ namespace OpenSim.Framework.Data.MySQL
271 MainLog.Instance.Error(e.ToString()); 269 MainLog.Instance.Error(e.ToString());
272 return; 270 return;
273 } 271 }
274 MainLog.Instance.Verbose("FRIEND", "Stub UpdateUserFriendPerms called");
275 } 272 }
276 273
277 274
@@ -318,7 +315,6 @@ namespace OpenSim.Framework.Data.MySQL
318 return Lfli; 315 return Lfli;
319 } 316 }
320 317
321 MainLog.Instance.Verbose("FRIEND", "Stub GetUserFriendList called");
322 return Lfli; 318 return Lfli;
323 } 319 }
324 320
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 7af1716..af2b27c 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -385,7 +385,7 @@ namespace OpenSim.Framework.Servers
385 response.StatusCode = 301; 385 response.StatusCode = 301;
386 response.RedirectLocation = "secondlife:///app/login?first_name=" + keysvals["username"] + "&last_name=" + 386 response.RedirectLocation = "secondlife:///app/login?first_name=" + keysvals["username"] + "&last_name=" +
387 keysvals["lastname"] + 387 keysvals["lastname"] +
388 "&location=home&grid=Other&web_login_key=796f2b2a-0131-41e4-af12-00f60c24c458"; 388 "&location=home&grid=other&web_login_key=796f2b2a-0131-41e4-af12-00f60c24c458";
389 389
390 response.OutputStream.Close(); 390 response.OutputStream.Close();
391 } // show_login_form == "FALSE" 391 } // show_login_form == "FALSE"
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index d50558f..0f1d845 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -101,7 +101,11 @@ namespace OpenSim.Grid.UserServer
101 httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); 101 httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
102 httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); 102 httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
103 httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar); 103 httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar);
104 104 httpServer.AddXmlRPCHandler("add_new_user_friend", m_userManager.XmlRpcResponseXmlRPCAddUserFriend);
105 httpServer.AddXmlRPCHandler("remove_user_friend", m_userManager.XmlRpcResponseXmlRPCRemoveUserFriend);
106 httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms);
107 httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList);
108
105 109
106 httpServer.AddStreamHandler( 110 httpServer.AddStreamHandler(
107 new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); 111 new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index a50419e..c905ffe 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -87,10 +87,29 @@ namespace OpenSim.Grid.UserServer
87 responseData["lastname" + i.ToString()] = returnUsers[i].lastName; 87 responseData["lastname" + i.ToString()] = returnUsers[i].lastName;
88 } 88 }
89 response.Value = responseData; 89 response.Value = responseData;
90 90
91 return response; 91 return response;
92 } 92 }
93 93
94 public XmlRpcResponse FriendListItemListtoXmlRPCResponse(List<FriendListItem> returnUsers)
95 {
96 XmlRpcResponse response = new XmlRpcResponse();
97 Hashtable responseData = new Hashtable();
98 // Query Result Information
99
100 responseData["avcount"] = (string)returnUsers.Count.ToString();
101
102 for (int i = 0; i < returnUsers.Count; i++)
103 {
104 responseData["ownerID" + i.ToString()] = returnUsers[i].FriendListOwner.UUID.ToString();
105 responseData["friendID" + i.ToString()] = returnUsers[i].Friend.UUID.ToString();
106 responseData["ownerPerms" + i.ToString()] = returnUsers[i].FriendListOwnerPerms.ToString();
107 responseData["friendPerms" + i.ToString()] = returnUsers[i].FriendPerms.ToString();
108 }
109 response.Value = responseData;
110
111 return response;
112 }
94 /// <summary> 113 /// <summary>
95 /// Converts a user profile to an XML element which can be returned 114 /// Converts a user profile to an XML element which can be returned
96 /// </summary> 115 /// </summary>
@@ -151,6 +170,83 @@ namespace OpenSim.Grid.UserServer
151 return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar); 170 return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar);
152 } 171 }
153 172
173 public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request)
174 {
175 XmlRpcResponse response = new XmlRpcResponse();
176 Hashtable requestData = (Hashtable)request.Params[0];
177 Hashtable responseData = new Hashtable();
178 string returnString = "FALSE";
179 // Query Result Information
180
181 if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
182 {
183 // UserManagerBase.AddNewuserFriend
184 AddNewUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"]));
185 returnString = "TRUE";
186 }
187 responseData["returnString"] = returnString;
188 response.Value = responseData;
189 return response;
190 }
191
192 public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request)
193 {
194 XmlRpcResponse response = new XmlRpcResponse();
195 Hashtable requestData = (Hashtable)request.Params[0];
196 Hashtable responseData = new Hashtable();
197 string returnString = "FALSE";
198 // Query Result Information
199
200 if (requestData.Contains("ownerID") && requestData.Contains("friendID"))
201 {
202 // UserManagerBase.AddNewuserFriend
203 RemoveUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]));
204 returnString = "TRUE";
205 }
206 responseData["returnString"] = returnString;
207 response.Value = responseData;
208 return response;
209
210 }
211
212 public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request)
213 {
214 XmlRpcResponse response = new XmlRpcResponse();
215 Hashtable requestData = (Hashtable)request.Params[0];
216 Hashtable responseData = new Hashtable();
217 string returnString = "FALSE";
218
219
220
221 if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
222 {
223 UpdateUserFriendPerms(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"]));
224 // UserManagerBase.
225 returnString = "TRUE";
226 }
227 responseData["returnString"] = returnString;
228 response.Value = responseData;
229 return response;
230 }
231
232 public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request)
233 {
234 XmlRpcResponse response = new XmlRpcResponse();
235 Hashtable requestData = (Hashtable)request.Params[0];
236 Hashtable responseData = new Hashtable();
237
238 List<FriendListItem> returndata = new List<FriendListItem>();
239
240
241
242 if (requestData.Contains("ownerID"))
243 {
244 returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"]));
245 }
246
247 return FriendListItemListtoXmlRPCResponse(returndata);
248 }
249
154 public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) 250 public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request)
155 { 251 {
156 XmlRpcResponse response = new XmlRpcResponse(); 252 XmlRpcResponse response = new XmlRpcResponse();
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index c205d08..e645074 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -109,6 +109,28 @@ namespace OpenSim.Region.Communications.OGS1
109 return pickerlist; 109 return pickerlist;
110 } 110 }
111 111
112 public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data)
113 {
114 List<FriendListItem> buddylist = new List<FriendListItem>();
115 int buddycount = Convert.ToInt32((string)data["avcount"]);
116
117
118 for (int i = 0; i < buddycount; i++)
119 {
120 FriendListItem buddylistitem = new FriendListItem();
121
122 buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]);
123 buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]);
124 buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]);
125 buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]);
126
127 buddylist.Add(buddylistitem);
128 }
129
130
131 return buddylist;
132 }
133
112 public UserProfileData GetUserProfile(string firstName, string lastName) 134 public UserProfileData GetUserProfile(string firstName, string lastName)
113 { 135 {
114 return GetUserProfile(firstName + " " + lastName); 136 return GetUserProfile(firstName + " " + lastName);
@@ -223,7 +245,49 @@ namespace OpenSim.Region.Communications.OGS1
223 /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> 245 /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
224 public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) 246 public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
225 { 247 {
248 try
249 {
250 Hashtable param = new Hashtable();
251 param["ownerID"] = friendlistowner.UUID.ToString();
252 param["friendID"] = friend.UUID.ToString();
253 param["friendPerms"] = perms.ToString();
254 IList parameters = new ArrayList();
255 parameters.Add(param);
226 256
257 XmlRpcRequest req = new XmlRpcRequest("add_new_user_friend", parameters);
258 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
259 Hashtable respData = (Hashtable)resp.Value;
260 if (respData != null)
261 {
262 if (respData.Contains("returnString"))
263 {
264 if ((string)respData["returnString"] == "TRUE")
265 {
266
267 }
268 else
269 {
270 MainLog.Instance.Warn("GRID", "Unable to add new friend, User Server Reported an issue");
271 }
272 }
273 else
274 {
275 MainLog.Instance.Warn("GRID", "Unable to add new friend, UserServer didn't understand me!");
276 }
277 }
278 else
279 {
280 MainLog.Instance.Warn("GRID", "Unable to add new friend, UserServer didn't understand me!");
281
282 }
283 }
284 catch (WebException e)
285 {
286 MainLog.Instance.Warn("GRID","Error when trying to AddNewUserFriend: " +
287 e.Message);
288
289 }
290
227 } 291 }
228 292
229 /// <summary> 293 /// <summary>
@@ -233,7 +297,49 @@ namespace OpenSim.Region.Communications.OGS1
233 /// <param name="friend">The Ex-friend agent</param> 297 /// <param name="friend">The Ex-friend agent</param>
234 public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) 298 public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
235 { 299 {
300 try
301 {
302 Hashtable param = new Hashtable();
303 param["ownerID"] = friendlistowner.UUID.ToString();
304 param["friendID"] = friend.UUID.ToString();
305
306
307 IList parameters = new ArrayList();
308 parameters.Add(param);
236 309
310 XmlRpcRequest req = new XmlRpcRequest("remove_user_friend", parameters);
311 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
312 Hashtable respData = (Hashtable)resp.Value;
313 if (respData != null)
314 {
315 if (respData.Contains("returnString"))
316 {
317 if ((string)respData["returnString"] == "TRUE")
318 {
319
320 }
321 else
322 {
323 MainLog.Instance.Warn("GRID", "Unable to remove friend, User Server Reported an issue");
324 }
325 }
326 else
327 {
328 MainLog.Instance.Warn("GRID", "Unable to remove friend, UserServer didn't understand me!");
329 }
330 }
331 else
332 {
333 MainLog.Instance.Warn("GRID", "Unable to remove friend, UserServer didn't understand me!");
334
335 }
336 }
337 catch (WebException e)
338 {
339 MainLog.Instance.Warn("GRID", "Error when trying to RemoveUserFriend: " +
340 e.Message);
341
342 }
237 } 343 }
238 344
239 /// <summary> 345 /// <summary>
@@ -244,7 +350,48 @@ namespace OpenSim.Region.Communications.OGS1
244 /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> 350 /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
245 public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) 351 public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
246 { 352 {
353 try
354 {
355 Hashtable param = new Hashtable();
356 param["ownerID"] = friendlistowner.UUID.ToString();
357 param["friendID"] = friend.UUID.ToString();
358 param["friendPerms"] = perms.ToString();
359 IList parameters = new ArrayList();
360 parameters.Add(param);
247 361
362 XmlRpcRequest req = new XmlRpcRequest("update_user_friend_perms", parameters);
363 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
364 Hashtable respData = (Hashtable)resp.Value;
365 if (respData != null)
366 {
367 if (respData.Contains("returnString"))
368 {
369 if ((string)respData["returnString"] == "TRUE")
370 {
371
372 }
373 else
374 {
375 MainLog.Instance.Warn("GRID", "Unable to update_user_friend_perms, User Server Reported an issue");
376 }
377 }
378 else
379 {
380 MainLog.Instance.Warn("GRID", "Unable to update_user_friend_perms, UserServer didn't understand me!");
381 }
382 }
383 else
384 {
385 MainLog.Instance.Warn("GRID", "Unable to update_user_friend_perms, UserServer didn't understand me!");
386
387 }
388 }
389 catch (WebException e)
390 {
391 MainLog.Instance.Warn("GRID", "Error when trying to update_user_friend_perms: " +
392 e.Message);
393
394 }
248 } 395 }
249 /// <summary> 396 /// <summary>
250 /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner 397 /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner
@@ -252,7 +399,33 @@ namespace OpenSim.Region.Communications.OGS1
252 /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param> 399 /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
253 public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner) 400 public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
254 { 401 {
255 return new List<FriendListItem>(); 402 List<FriendListItem> buddylist = new List<FriendListItem>();
403
404 try
405 {
406 Hashtable param = new Hashtable();
407 param["ownerID"] = friendlistowner.UUID.ToString();
408
409 IList parameters = new ArrayList();
410 parameters.Add(param);
411 XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters);
412 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
413 Hashtable respData = (Hashtable) resp.Value;
414
415 if (respData.Contains("avcount"))
416 {
417 buddylist = ConvertXMLRPCDataToFriendListItemList(respData);
418 }
419
420 }
421 catch (WebException e)
422 {
423 MainLog.Instance.Warn("Error when trying to fetch Avatar's friends list: " +
424 e.Message);
425 // Return Empty list (no friends)
426 }
427 return buddylist;
428
256 } 429 }
257 430
258 #endregion 431 #endregion