aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-02 00:54:50 +0000
committerTeravus Ovares2008-01-02 00:54:50 +0000
commit3738bc88999d4cf8060fa2535cb264e0cddcb8c7 (patch)
tree3e113c52cc51f7f8c7a43a938afcd27d6edb2579 /OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
parentFixed nant compile problem (diff)
downloadopensim-SC_OLD-3738bc88999d4cf8060fa2535cb264e0cddcb8c7.zip
opensim-SC_OLD-3738bc88999d4cf8060fa2535cb264e0cddcb8c7.tar.gz
opensim-SC_OLD-3738bc88999d4cf8060fa2535cb264e0cddcb8c7.tar.bz2
opensim-SC_OLD-3738bc88999d4cf8060fa2535cb264e0cddcb8c7.tar.xz
* Updates UserServer
* Updates OSG1UserServices * Friends list is now persistent in grid mode. * You can add, new friends and remove them
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1UserServices.cs')
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs175
1 files changed, 174 insertions, 1 deletions
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