aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs61
1 files changed, 58 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
index 5aa87d3..b510d0a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
@@ -26,6 +26,8 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
30using System.Collections.Generic;
29using Nini.Config; 31using Nini.Config;
30using log4net; 32using log4net;
31using Mono.Addins; 33using Mono.Addins;
@@ -34,6 +36,7 @@ using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
35using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
36using OpenSim.Services.Connectors; 38using OpenSim.Services.Connectors;
39using OpenSim.Framework;
37 40
38using OpenMetaverse; 41using OpenMetaverse;
39 42
@@ -50,7 +53,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
50 private bool m_Enabled = false; 53 private bool m_Enabled = false;
51 private UserAccountCache m_Cache; 54 private UserAccountCache m_Cache;
52 55
53 public Type ReplaceableInterface 56 public Type ReplaceableInterface
54 { 57 {
55 get { return null; } 58 get { return null; }
56 } 59 }
@@ -103,6 +106,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
103 return; 106 return;
104 107
105 scene.RegisterModuleInterface<IUserAccountService>(this); 108 scene.RegisterModuleInterface<IUserAccountService>(this);
109 scene.RegisterModuleInterface<IUserAccountCacheModule>(m_Cache);
110
111 scene.EventManager.OnNewClient += OnNewClient;
106 } 112 }
107 113
108 public void RemoveRegion(Scene scene) 114 public void RemoveRegion(Scene scene)
@@ -117,12 +123,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
117 return; 123 return;
118 } 124 }
119 125
126 // When a user actually enters the sim, clear them from
127 // cache so the sim will have the current values for
128 // flags, title, etc. And country, don't forget country!
129 private void OnNewClient(IClientAPI client)
130 {
131 m_Cache.Remove(client.Name);
132 }
133
120 #region Overwritten methods from IUserAccountService 134 #region Overwritten methods from IUserAccountService
121 135
122 public override UserAccount GetUserAccount(UUID scopeID, UUID userID) 136 public override UserAccount GetUserAccount(UUID scopeID, UUID userID)
123 { 137 {
124 bool inCache = false; 138 bool inCache = false;
125 UserAccount account = m_Cache.Get(userID, out inCache); 139 UserAccount account;
140 account = m_Cache.Get(userID, out inCache);
126 if (inCache) 141 if (inCache)
127 return account; 142 return account;
128 143
@@ -135,7 +150,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
135 public override UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) 150 public override UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)
136 { 151 {
137 bool inCache = false; 152 bool inCache = false;
138 UserAccount account = m_Cache.Get(firstName + " " + lastName, out inCache); 153 UserAccount account;
154 account = m_Cache.Get(firstName + " " + lastName, out inCache);
139 if (inCache) 155 if (inCache)
140 return account; 156 return account;
141 157
@@ -146,6 +162,45 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
146 return account; 162 return account;
147 } 163 }
148 164
165 public override List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs)
166 {
167 List<UserAccount> accs = new List<UserAccount>();
168 List<string> missing = new List<string>();
169
170 UUID uuid = UUID.Zero;
171 UserAccount account;
172 bool inCache = false;
173
174 foreach(string id in IDs)
175 {
176 if(UUID.TryParse(id, out uuid))
177 {
178 account = m_Cache.Get(uuid, out inCache);
179 if (inCache)
180 accs.Add(account);
181 else
182 missing.Add(id);
183 }
184 }
185
186 if(missing.Count > 0)
187 {
188 List<UserAccount> ext = base.GetUserAccounts(scopeID, missing);
189 if(ext != null && ext.Count >0 )
190 {
191 foreach(UserAccount acc in ext)
192 {
193 if(acc != null)
194 {
195 accs.Add(acc);
196 m_Cache.Cache(acc.PrincipalID, acc);
197 }
198 }
199 }
200 }
201 return accs;
202 }
203
149 public override bool StoreUserAccount(UserAccount data) 204 public override bool StoreUserAccount(UserAccount data)
150 { 205 {
151 // This remote connector refuses to serve this method 206 // This remote connector refuses to serve this method