aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2011-01-24 02:16:28 +0100
committerMelanie2011-01-24 02:16:28 +0100
commitdbbf43663e688b136d806965edfb82b4cd9e3e91 (patch)
tree48a3ffa0bf6a29a80edb34632aabd3451fdf9a55
parentMerge branch 'master' into careminster-presence-refactor (diff)
downloadopensim-SC_OLD-dbbf43663e688b136d806965edfb82b4cd9e3e91.zip
opensim-SC_OLD-dbbf43663e688b136d806965edfb82b4cd9e3e91.tar.gz
opensim-SC_OLD-dbbf43663e688b136d806965edfb82b4cd9e3e91.tar.bz2
opensim-SC_OLD-dbbf43663e688b136d806965edfb82b4cd9e3e91.tar.xz
Add a careminster API to scripting again
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs11
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs13
-rw-r--r--OpenSim/Services/Interfaces/IUserAccountService.cs4
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs4
4 files changed, 32 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
index 3321b38..348ad42 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
@@ -33,6 +33,7 @@ using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
35using OpenSim.Services.Connectors; 35using OpenSim.Services.Connectors;
36using OpenSim.Framework;
36 37
37using OpenMetaverse; 38using OpenMetaverse;
38 39
@@ -101,6 +102,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
101 return; 102 return;
102 103
103 scene.RegisterModuleInterface<IUserAccountService>(this); 104 scene.RegisterModuleInterface<IUserAccountService>(this);
105
106 scene.EventManager.OnNewClient += OnNewClient;
104 } 107 }
105 108
106 public void RemoveRegion(Scene scene) 109 public void RemoveRegion(Scene scene)
@@ -115,6 +118,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
115 return; 118 return;
116 } 119 }
117 120
121 // When a user actually enters the sim, clear them from
122 // cache so the sim will have the current values for
123 // flags, title, etc. And country, don't forget country!
124 private void OnNewClient(IClientAPI client)
125 {
126 m_Cache.Remove(client.Name);
127 }
128
118 #region Overwritten methods from IUserAccountService 129 #region Overwritten methods from IUserAccountService
119 130
120 public override UserAccount GetUserAccount(UUID scopeID, UUID userID) 131 public override UserAccount GetUserAccount(UUID scopeID, UUID userID)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
index 155335b..07c127e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
@@ -91,5 +91,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
91 91
92 return null; 92 return null;
93 } 93 }
94
95 public void Remove(string name)
96 {
97 if (!m_NameCache.Contains(name))
98 return;
99
100 UUID uuid = UUID.Zero;
101 if (m_NameCache.TryGetValue(name, out uuid))
102 {
103 m_NameCache.Remove(name);
104 m_UUIDCache.Remove(uuid);
105 }
106 }
94 } 107 }
95} 108}
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs
index 80258d6..a91aa0f 100644
--- a/OpenSim/Services/Interfaces/IUserAccountService.cs
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -63,6 +63,7 @@ namespace OpenSim.Services.Interfaces
63 public int UserLevel; 63 public int UserLevel;
64 public int UserFlags; 64 public int UserFlags;
65 public string UserTitle; 65 public string UserTitle;
66 public string UserCountry;
66 67
67 public Dictionary<string, object> ServiceURLs; 68 public Dictionary<string, object> ServiceURLs;
68 69
@@ -91,6 +92,8 @@ namespace OpenSim.Services.Interfaces
91 UserFlags = Convert.ToInt32(kvp["UserFlags"].ToString()); 92 UserFlags = Convert.ToInt32(kvp["UserFlags"].ToString());
92 if (kvp.ContainsKey("UserTitle")) 93 if (kvp.ContainsKey("UserTitle"))
93 UserTitle = kvp["UserTitle"].ToString(); 94 UserTitle = kvp["UserTitle"].ToString();
95 if (kvp.ContainsKey("UserCountry"))
96 UserCountry = kvp["UserCountry"].ToString();
94 97
95 if (kvp.ContainsKey("Created")) 98 if (kvp.ContainsKey("Created"))
96 Created = Convert.ToInt32(kvp["Created"].ToString()); 99 Created = Convert.ToInt32(kvp["Created"].ToString());
@@ -124,6 +127,7 @@ namespace OpenSim.Services.Interfaces
124 result["UserLevel"] = UserLevel.ToString(); 127 result["UserLevel"] = UserLevel.ToString();
125 result["UserFlags"] = UserFlags.ToString(); 128 result["UserFlags"] = UserFlags.ToString();
126 result["UserTitle"] = UserTitle; 129 result["UserTitle"] = UserTitle;
130 result["UserCountry"] = UserCountry;
127 131
128 string str = string.Empty; 132 string str = string.Empty;
129 foreach (KeyValuePair<string, object> kvp in ServiceURLs) 133 foreach (KeyValuePair<string, object> kvp in ServiceURLs)
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index de6d32c..cbd6f35 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -148,6 +148,10 @@ namespace OpenSim.Services.UserAccountService
148 Int32.TryParse(d.Data["UserLevel"], out u.UserLevel); 148 Int32.TryParse(d.Data["UserLevel"], out u.UserLevel);
149 if (d.Data.ContainsKey("UserFlags") && d.Data["UserFlags"] != null) 149 if (d.Data.ContainsKey("UserFlags") && d.Data["UserFlags"] != null)
150 Int32.TryParse(d.Data["UserFlags"], out u.UserFlags); 150 Int32.TryParse(d.Data["UserFlags"], out u.UserFlags);
151 if (d.Data.ContainsKey("UserCountry") && d.Data["UserCountry"] != null)
152 u.UserCountry = d.Data["UserCountry"].ToString();
153 else
154 u.UserTitle = string.Empty;
151 155
152 if (d.Data.ContainsKey("ServiceURLs") && d.Data["ServiceURLs"] != null) 156 if (d.Data.ContainsKey("ServiceURLs") && d.Data["ServiceURLs"] != null)
153 { 157 {