aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-01-03 18:22:14 +0000
committerJustin Clark-Casey (justincc)2012-01-03 18:22:14 +0000
commit01eacd3a314b866ce8c6b60f4b1e5643ac96cb65 (patch)
treec27315f31043460626f1433ad5028a7e2093dfe8 /OpenSim
parentminor: add missing newlines to pCampbot usage statement (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-01eacd3a314b866ce8c6b60f4b1e5643ac96cb65.zip
opensim-SC_OLD-01eacd3a314b866ce8c6b60f4b1e5643ac96cb65.tar.gz
opensim-SC_OLD-01eacd3a314b866ce8c6b60f4b1e5643ac96cb65.tar.bz2
opensim-SC_OLD-01eacd3a314b866ce8c6b60f4b1e5643ac96cb65.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/IProfileModule.cs37
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs93
-rw-r--r--OpenSim/Region/Framework/Interfaces/IUserManagement.cs3
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs33
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs54
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs25
-rw-r--r--OpenSim/Services/Interfaces/IHypergridServices.cs1
8 files changed, 253 insertions, 5 deletions
diff --git a/OpenSim/Framework/IProfileModule.cs b/OpenSim/Framework/IProfileModule.cs
new file mode 100644
index 0000000..ef03d4a
--- /dev/null
+++ b/OpenSim/Framework/IProfileModule.cs
@@ -0,0 +1,37 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework
31{
32 public interface IProfileModule
33 {
34 void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID);
35
36 }
37}
diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
index dee0ad4..eb1e4b5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
@@ -43,7 +43,7 @@ using OpenSim.Services.Interfaces;
43namespace OpenSim.Region.CoreModules.Avatar.Profile 43namespace OpenSim.Region.CoreModules.Avatar.Profile
44{ 44{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
46 public class BasicProfileModule : ISharedRegionModule 46 public class BasicProfileModule : IProfileModule, ISharedRegionModule
47 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
@@ -57,6 +57,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
57 57
58 public void Initialise(IConfigSource config) 58 public void Initialise(IConfigSource config)
59 { 59 {
60 // This can be reduced later as the loader will determine
61 // whether we are needed
60 if (config.Configs["Profile"] != null) 62 if (config.Configs["Profile"] != null)
61 { 63 {
62 if (config.Configs["Profile"].GetString("Module", string.Empty) != "BasicProfileModule") 64 if (config.Configs["Profile"].GetString("Module", string.Empty) != "BasicProfileModule")
@@ -65,14 +67,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
65 67
66 m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled"); 68 m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled");
67 m_Enabled = true; 69 m_Enabled = true;
68
69 } 70 }
70 71
71 public void AddRegion(Scene scene) 72 public void AddRegion(Scene scene)
72 { 73 {
73 if (!m_Enabled) 74 if (!m_Enabled)
74 return; 75 return;
75 76
76 lock (m_Scenes) 77 lock (m_Scenes)
77 { 78 {
78 if (!m_Scenes.Contains(scene)) 79 if (!m_Scenes.Contains(scene))
@@ -80,6 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
80 m_Scenes.Add(scene); 81 m_Scenes.Add(scene);
81 // Hook up events 82 // Hook up events
82 scene.EventManager.OnNewClient += OnNewClient; 83 scene.EventManager.OnNewClient += OnNewClient;
84 scene.RegisterModuleInterface<IProfileModule>(this);
83 } 85 }
84 } 86 }
85 } 87 }
@@ -116,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
116 118
117 public Type ReplaceableInterface 119 public Type ReplaceableInterface
118 { 120 {
119 get { return null; } 121 get { return typeof(IProfileModule); }
120 } 122 }
121 123
122 #endregion 124 #endregion
@@ -170,4 +172,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
170 } 172 }
171 173
172 } 174 }
173} \ No newline at end of file 175}
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index dbe2560..37292d6 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -50,6 +50,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
50 public string LastName { get; set; } 50 public string LastName { get; set; }
51 public string HomeURL { get; set; } 51 public string HomeURL { get; set; }
52 public Dictionary<string, object> ServerURLs { get; set; } 52 public Dictionary<string, object> ServerURLs { get; set; }
53 public string Title { get; set; }
54 public int Flags { get; set; }
55 public int Created { get; set; }
53 } 56 }
54 57
55 public class UserManagementModule : ISharedRegionModule, IUserManagement 58 public class UserManagementModule : ISharedRegionModule, IUserManagement
@@ -281,6 +284,94 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
281 return string.Empty; 284 return string.Empty;
282 } 285 }
283 286
287 public int GetUserFlags(UUID userID)
288 {
289 UserData userdata;
290 lock (m_UserCache)
291 m_UserCache.TryGetValue(userID, out userdata);
292
293 if (userdata.Flags == -1)
294 GetUserInfo(userID);
295
296 if (userdata.Flags != -1)
297 return userdata.Flags;
298
299 return 0;
300 }
301
302 public int GetUserCreated(UUID userID)
303 {
304 UserData userdata;
305 lock (m_UserCache)
306 m_UserCache.TryGetValue(userID, out userdata);
307
308 if (userdata.Flags == -1)
309 GetUserInfo(userID);
310
311 if (userdata.Created != -1)
312 return userdata.Created;
313
314 return 0;
315 }
316
317 public string GetUserTitle(UUID userID)
318 {
319 UserData userdata;
320 lock (m_UserCache)
321 m_UserCache.TryGetValue(userID, out userdata);
322
323 if (userdata.Flags == -1)
324 GetUserInfo(userID);
325
326 if (userdata.Created != -1)
327 return userdata.Title;
328
329 return string.Empty;
330 }
331
332 // This will cache the user data
333 // Change this to return bool
334 private bool GetUserInfo(UUID userID)
335 {
336 UserData userdata;
337 lock (m_UserCache)
338 m_UserCache.TryGetValue(userID, out userdata);
339
340 if (userdata != null)
341 {
342// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID);
343
344 if (userdata.Flags >= 0)
345 {
346 // This is already populated
347 return true;
348 }
349
350 if (userdata.HomeURL != null && userdata.HomeURL != string.Empty)
351 {
352 m_log.DebugFormat(
353 "[USER MANAGEMENT MODULE]: Requesting user flags from '{0}' for {1}",
354 userdata.HomeURL, userID);
355
356 UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
357 Dictionary<string, object> info = uConn.GetUserInfo(userID);
358
359 // Pull our data now
360 if (info["result"].ToString() == "success")
361 {
362 userdata.Flags = (int)info["user_flags"];
363 userdata.Created = (int)info["user_created"];
364 userdata.Title = (string)info["user_title"];
365
366 return true;
367 }
368 }
369 }
370
371 return false;
372 }
373
374
284 public string GetUserUUI(UUID userID) 375 public string GetUserUUI(UUID userID)
285 { 376 {
286 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID); 377 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID);
@@ -352,6 +443,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
352 { 443 {
353 UserData user = new UserData(); 444 UserData user = new UserData();
354 user.Id = id; 445 user.Id = id;
446 user.Flags = -1;
447 user.Created = -1;
355 448
356 if (creatorData != null && creatorData != string.Empty) 449 if (creatorData != null && creatorData != string.Empty)
357 { 450 {
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
index ea0ba59..54dfaf4 100644
--- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
+++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
@@ -14,6 +14,9 @@ namespace OpenSim.Region.Framework.Interfaces
14 string GetUserHomeURL(UUID uuid); 14 string GetUserHomeURL(UUID uuid);
15 string GetUserUUI(UUID uuid); 15 string GetUserUUI(UUID uuid);
16 string GetUserServerURL(UUID uuid, string serverType); 16 string GetUserServerURL(UUID uuid, string serverType);
17 int GetUserFlags(UUID userID);
18 int GetUserCreated(UUID userID);
19 string GetUserTitle(UUID userID);
17 20
18 /// <summary> 21 /// <summary>
19 /// Add a user. 22 /// Add a user.
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
index 07c6962..1bd3706 100644
--- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
@@ -91,6 +91,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
91 91
92 server.AddXmlRPCHandler("status_notification", StatusNotification, false); 92 server.AddXmlRPCHandler("status_notification", StatusNotification, false);
93 server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false); 93 server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false);
94 server.AddXmlRPCHandler("get_user_info", GetUserInfo, false);
94 server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false); 95 server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false);
95 96
96 server.AddXmlRPCHandler("locate_user", LocateUser, false); 97 server.AddXmlRPCHandler("locate_user", LocateUser, false);
@@ -299,6 +300,38 @@ namespace OpenSim.Server.Handlers.Hypergrid
299 300
300 } 301 }
301 302
303 public XmlRpcResponse GetUserInfo(XmlRpcRequest request, IPEndPoint remoteClient)
304 {
305 Hashtable hash = new Hashtable();
306 Hashtable requestData = (Hashtable)request.Params[0];
307
308 // This needs checking!
309 if (requestData.ContainsKey("userID"))
310 {
311 string userID_str = (string)requestData["userID"];
312 UUID userID = UUID.Zero;
313 UUID.TryParse(userID_str, out userID);
314
315 //int userFlags = m_HomeUsersService.GetUserFlags(userID);
316 Dictionary<string,object> userInfo = m_HomeUsersService.GetUserInfo(userID);
317 if (userInfo.Count > 0)
318 {
319 foreach (KeyValuePair<string, object> kvp in userInfo)
320 {
321 hash[kvp.Key] = kvp.Value;
322 }
323 }
324 else
325 {
326 hash["result"] = "failure";
327 }
328 }
329
330 XmlRpcResponse response = new XmlRpcResponse();
331 response.Value = hash;
332 return response;
333 }
334
302 public XmlRpcResponse GetServerURLs(XmlRpcRequest request, IPEndPoint remoteClient) 335 public XmlRpcResponse GetServerURLs(XmlRpcRequest request, IPEndPoint remoteClient)
303 { 336 {
304 Hashtable hash = new Hashtable(); 337 Hashtable hash = new Hashtable();
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 57b6d16..5b27cf6 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -561,6 +561,60 @@ namespace OpenSim.Services.Connectors.Hypergrid
561 return online; 561 return online;
562 } 562 }
563 563
564 public Dictionary<string,object> GetUserInfo (UUID userID)
565 {
566 Hashtable hash = new Hashtable();
567 hash["userID"] = userID.ToString();
568
569 IList paramList = new ArrayList();
570 paramList.Add(hash);
571
572 XmlRpcRequest request = new XmlRpcRequest("get_user_info", paramList);
573
574 Dictionary<string, object> info = new Dictionary<string, object>();
575 XmlRpcResponse response = null;
576 try
577 {
578 response = request.Send(m_ServerURL, 10000);
579 }
580 catch
581 {
582 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUserInfo", m_ServerURL);
583 return info;
584 }
585
586 if (response.IsFault)
587 {
588 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString);
589 return info;
590 }
591
592 hash = (Hashtable)response.Value;
593 try
594 {
595 if (hash == null)
596 {
597 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUserInfo Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
598 return info;
599 }
600
601 // Here is the actual response
602 foreach (object key in hash.Keys)
603 {
604 if (hash[key] != null)
605 {
606 info.Add(key.ToString(), hash[key]);
607 }
608 }
609 }
610 catch
611 {
612 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
613 }
614
615 return info;
616 }
617
564 public Dictionary<string, object> GetServerURLs(UUID userID) 618 public Dictionary<string, object> GetServerURLs(UUID userID)
565 { 619 {
566 Hashtable hash = new Hashtable(); 620 Hashtable hash = new Hashtable();
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 8538660..f681df4 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -488,6 +488,31 @@ namespace OpenSim.Services.HypergridService
488 return online; 488 return online;
489 } 489 }
490 490
491 public Dictionary<string, object> GetUserInfo(UUID userID)
492 {
493 Dictionary<string, object> info = new Dictionary<string, object>();
494
495 if (m_UserAccountService == null)
496 {
497 m_log.WarnFormat("[USER AGENT SERVICE]: Unable to get user flags because user account service is missing");
498 info["result"] = "fail";
499 info["message"] = "UserAccountService is missing!";
500 return info;
501 }
502
503 UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero /*!!!*/, userID);
504
505 if (account != null)
506 {
507 info.Add("user_flags", (object)account.UserFlags);
508 info.Add("user_created", (object)account.Created);
509 info.Add("user_title", (object)account.UserTitle);
510 info.Add("result", "success");
511 }
512
513 return info;
514 }
515
491 public Dictionary<string, object> GetServerURLs(UUID userID) 516 public Dictionary<string, object> GetServerURLs(UUID userID)
492 { 517 {
493 if (m_UserAccountService == null) 518 if (m_UserAccountService == null)
diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs
index e86ec51..5b293ac 100644
--- a/OpenSim/Services/Interfaces/IHypergridServices.cs
+++ b/OpenSim/Services/Interfaces/IHypergridServices.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Services.Interfaces
55 void LogoutAgent(UUID userID, UUID sessionID); 55 void LogoutAgent(UUID userID, UUID sessionID);
56 GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); 56 GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt);
57 Dictionary<string, object> GetServerURLs(UUID userID); 57 Dictionary<string, object> GetServerURLs(UUID userID);
58 Dictionary<string,object> GetUserInfo(UUID userID);
58 59
59 string LocateUser(UUID userID); 60 string LocateUser(UUID userID);
60 // Tries to get the universal user identifier for the targetUserId 61 // Tries to get the universal user identifier for the targetUserId