aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs19
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs26
-rw-r--r--OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs161
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs169
6 files changed, 334 insertions, 48 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
index 9d1538f..4ea85a8 100644
--- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
@@ -69,9 +69,10 @@ namespace OpenSim.Region.CoreModules.Framework
69 { 69 {
70 m_scene = scene; 70 m_scene = scene;
71 m_scene.RegisterModuleInterface<ICapabilitiesModule>(this); 71 m_scene.RegisterModuleInterface<ICapabilitiesModule>(this);
72 MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps", 72
73 MainConsole.Instance.Commands.AddCommand("Comms", false, "show caps",
73 "show caps", 74 "show caps",
74 "Shows all registered capabilities", HandleShowCapsCommand); 75 "Shows all registered capabilities for users", HandleShowCapsCommand);
75 } 76 }
76 77
77 public void RegionLoaded(Scene scene) 78 public void RegionLoaded(Scene scene)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index f6e4dbf..2d73594 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -304,6 +304,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
304 return; 304 return;
305 } 305 }
306 306
307 if (IsInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this.
308 return;
309
307 m_log.DebugFormat( 310 m_log.DebugFormat(
308 "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}", 311 "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}",
309 reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); 312 reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
@@ -444,7 +447,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
444 "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.", 447 "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.",
445 sp.Name, finalDestination.RegionName); 448 sp.Name, finalDestination.RegionName);
446 449
447 Fail(sp, finalDestination); 450 Fail(sp, finalDestination, logout);
448 return; 451 return;
449 } 452 }
450 453
@@ -476,7 +479,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
476 "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.", 479 "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.",
477 sp.Name, finalDestination.RegionName); 480 sp.Name, finalDestination.RegionName);
478 481
479 Fail(sp, finalDestination); 482 Fail(sp, finalDestination, logout);
480 return; 483 return;
481 } 484 }
482 485
@@ -527,7 +530,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
527 } 530 }
528 } 531 }
529 532
530 private void Fail(ScenePresence sp, GridRegion finalDestination) 533 protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout)
531 { 534 {
532 // Client never contacted destination. Let's restore everything back 535 // Client never contacted destination. Let's restore everything back
533 sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); 536 sp.ControllingClient.SendTeleportFailed("Problems connecting to destination.");
@@ -1861,6 +1864,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1861 } 1864 }
1862 } 1865 }
1863 1866
1867 protected bool IsInTransit(UUID id)
1868 {
1869 lock (m_agentsInTransit)
1870 {
1871 if (m_agentsInTransit.Contains(id))
1872 return true;
1873 }
1874 return false;
1875 }
1876
1864 protected bool ResetFromTransit(UUID id) 1877 protected bool ResetFromTransit(UUID id)
1865 { 1878 {
1866 lock (m_agentsInTransit) 1879 lock (m_agentsInTransit)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 38a7805..b277095 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -50,6 +50,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
50 50
51 private bool m_Initialized = false; 51 private bool m_Initialized = false;
52 52
53 private bool m_RestrictInventoryAccessAbroad = false;
54
53 private GatekeeperServiceConnector m_GatekeeperConnector; 55 private GatekeeperServiceConnector m_GatekeeperConnector;
54 56
55 #region ISharedRegionModule 57 #region ISharedRegionModule
@@ -68,6 +70,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
68 if (name == Name) 70 if (name == Name)
69 { 71 {
70 InitialiseCommon(source); 72 InitialiseCommon(source);
73 IConfig transferConfig = source.Configs["HGEntityTransfer"];
74 if (transferConfig != null)
75 m_RestrictInventoryAccessAbroad = transferConfig.GetBoolean("RestrictInventoryAccessAbroad", false);
76
71 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); 77 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
72 } 78 }
73 } 79 }
@@ -170,6 +176,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
170 bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); 176 bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason);
171 logout = success; // flag for later logout from this grid; this is an HG TP 177 logout = success; // flag for later logout from this grid; this is an HG TP
172 178
179 if (success && m_RestrictInventoryAccessAbroad)
180 {
181 // TODO tell the viewer to remove the root folder
182 }
183
173 return success; 184 return success;
174 } 185 }
175 else 186 else
@@ -283,6 +294,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
283 294
284 } 295 }
285 296
297 protected override void Fail(ScenePresence sp, GridRegion finalDestination, bool logout)
298 {
299 base.Fail(sp, finalDestination, logout);
300 if (logout && m_RestrictInventoryAccessAbroad)
301 {
302 // Restore the user's inventory, because we removed it earlier on
303 InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(sp.UUID);
304 if (root != null)
305 {
306 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring");
307 sp.ControllingClient.SendBulkUpdateInventory(root);
308 }
309 }
310 }
311
286 #endregion 312 #endregion
287 313
288 #region IUserAgentVerificationModule 314 #region IUserAgentVerificationModule
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
index 3f466be..7f8271d 100644
--- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
72 72
73 m_scene = scene; 73 m_scene = scene;
74 74
75 m_scene.AddCommand(this, "monitor report", 75 m_scene.AddCommand("General", this, "monitor report",
76 "monitor report", 76 "monitor report",
77 "Returns a variety of statistics about the current region and/or simulator", 77 "Returns a variety of statistics about the current region and/or simulator",
78 DebugMonitors); 78 DebugMonitors);
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
new file mode 100644
index 0000000..4eecaa2
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
@@ -0,0 +1,161 @@
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 */
27using System;
28using System.Collections.Generic;
29using System.IO;
30using System.Reflection;
31
32using OpenSim.Framework;
33using OpenSim.Framework.Console;
34using OpenSim.Region.Framework;
35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces;
38using OpenSim.Services.Connectors.Hypergrid;
39
40using OpenMetaverse;
41using OpenMetaverse.Packets;
42using log4net;
43using Nini.Config;
44
45namespace OpenSim.Region.CoreModules.Framework.UserManagement
46{
47 public class HGUserManagementModule : UserManagementModule, ISharedRegionModule, IUserManagement
48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51
52 #region ISharedRegionModule
53
54 public new void Initialise(IConfigSource config)
55 {
56 string umanmod = config.Configs["Modules"].GetString("UserManagementModule", base.Name);
57 if (umanmod == Name)
58 {
59 m_Enabled = true;
60 RegisterConsoleCmds();
61 m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name);
62 }
63 }
64
65 public override string Name
66 {
67 get { return "HGUserManagementModule"; }
68 }
69
70 #endregion ISharedRegionModule
71
72 protected override void AddAdditionalUsers(UUID avatarID, string query, List<UserData> users)
73 {
74 if (query.Contains("@")) // First.Last@foo.com, maybe?
75 {
76 string[] words = query.Split(new char[] { '@' });
77 if (words.Length != 2)
78 {
79 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", query);
80 return;
81 }
82
83 words[0] = words[0].Trim(); // it has at least 1
84 words[1] = words[1].Trim();
85
86 if (words[0] == String.Empty) // query was @foo.com?
87 {
88 foreach (UserData d in m_UserCache.Values)
89 {
90 if (d.LastName.ToLower().StartsWith("@" + words[1].ToLower()))
91 users.Add(d);
92 }
93
94 // We're done
95 return;
96 }
97
98 // words.Length == 2 and words[0] != string.empty
99 // first.last@foo.com ?
100 foreach (UserData d in m_UserCache.Values)
101 {
102 if (d.LastName.StartsWith("@") &&
103 d.FirstName.ToLower().Equals(words[0].ToLower()) &&
104 d.LastName.ToLower().Equals("@" + words[1].ToLower()))
105 {
106 users.Add(d);
107 // It's cached. We're done
108 return;
109 }
110 }
111
112 // This is it! Let's ask the other world
113 if (words[0].Contains("."))
114 {
115 string[] names = words[0].Split(new char[] { '.' });
116 if (names.Length >= 2)
117 {
118
119 string uriStr = "http://" + words[1];
120 // Let's check that the last name is a valid address
121 try
122 {
123 new Uri(uriStr);
124 }
125 catch (UriFormatException)
126 {
127 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", uriStr);
128 return;
129 }
130
131 UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr);
132 UUID userID = uasConn.GetUUID(names[0], names[1]);
133 if (!userID.Equals(UUID.Zero))
134 {
135 UserData ud = new UserData();
136 ud.Id = userID;
137 ud.FirstName = words[0];
138 ud.LastName = "@" + words[1];
139 users.Add(ud);
140 AddUser(userID, names[0], names[1], uriStr);
141 m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} found", words[0], words[1]);
142 }
143 else
144 m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} not found", words[0], words[1]);
145 }
146 }
147 }
148 //else
149 //{
150 // foreach (UserData d in m_UserCache.Values)
151 // {
152 // if (d.LastName.StartsWith("@") &&
153 // (d.FirstName.ToLower().StartsWith(query.ToLower()) ||
154 // d.LastName.ToLower().StartsWith(query.ToLower())))
155 // users.Add(d);
156 // }
157 //}
158 }
159
160 }
161} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index b4f6b5a..0397478 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -38,12 +38,13 @@ using OpenSim.Services.Interfaces;
38using OpenSim.Services.Connectors.Hypergrid; 38using OpenSim.Services.Connectors.Hypergrid;
39 39
40using OpenMetaverse; 40using OpenMetaverse;
41using OpenMetaverse.Packets;
41using log4net; 42using log4net;
42using Nini.Config; 43using Nini.Config;
43 44
44namespace OpenSim.Region.CoreModules.Framework.UserManagement 45namespace OpenSim.Region.CoreModules.Framework.UserManagement
45{ 46{
46 class UserData 47 public class UserData
47 { 48 {
48 public UUID Id { get; set; } 49 public UUID Id { get; set; }
49 public string FirstName { get; set; } 50 public string FirstName { get; set; }
@@ -56,36 +57,23 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
56 { 57 {
57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 58 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58 59
59 private List<Scene> m_Scenes = new List<Scene>(); 60 protected bool m_Enabled;
61 protected List<Scene> m_Scenes = new List<Scene>();
60 62
61 // The cache 63 // The cache
62 Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>(); 64 protected Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>();
63 65
64 #region ISharedRegionModule 66 #region ISharedRegionModule
65 67
66 public void Initialise(IConfigSource config) 68 public void Initialise(IConfigSource config)
67 { 69 {
68 //m_Enabled = config.Configs["Modules"].GetBoolean("LibraryModule", m_Enabled); 70 string umanmod = config.Configs["Modules"].GetString("UserManagementModule", Name);
69 //if (m_Enabled) 71 if (umanmod == Name)
70 //{ 72 {
71 // IConfig libConfig = config.Configs["LibraryService"]; 73 m_Enabled = true;
72 // if (libConfig != null) 74 RegisterConsoleCmds();
73 // { 75 m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name);
74 // string dllName = libConfig.GetString("LocalServiceModule", string.Empty); 76 }
75 // m_log.Debug("[LIBRARY MODULE]: Library service dll is " + dllName);
76 // if (dllName != string.Empty)
77 // {
78 // Object[] args = new Object[] { config };
79 // m_Library = ServerUtils.LoadPlugin<ILibraryService>(dllName, args);
80 // }
81 // }
82 //}
83 MainConsole.Instance.Commands.AddCommand("grid", true,
84 "show names",
85 "show names",
86 "Show the bindings between user UUIDs and user names",
87 String.Empty,
88 HandleShowUsers);
89 } 77 }
90 78
91 public bool IsSharedModule 79 public bool IsSharedModule
@@ -93,9 +81,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
93 get { return true; } 81 get { return true; }
94 } 82 }
95 83
96 public string Name 84 public virtual string Name
97 { 85 {
98 get { return "UserManagement Module"; } 86 get { return "BasicUserManagementModule"; }
99 } 87 }
100 88
101 public Type ReplaceableInterface 89 public Type ReplaceableInterface
@@ -105,17 +93,23 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
105 93
106 public void AddRegion(Scene scene) 94 public void AddRegion(Scene scene)
107 { 95 {
108 m_Scenes.Add(scene); 96 if (m_Enabled)
97 {
98 m_Scenes.Add(scene);
109 99
110 scene.RegisterModuleInterface<IUserManagement>(this); 100 scene.RegisterModuleInterface<IUserManagement>(this);
111 scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient); 101 scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient);
112 scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded); 102 scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded);
103 }
113 } 104 }
114 105
115 public void RemoveRegion(Scene scene) 106 public void RemoveRegion(Scene scene)
116 { 107 {
117 scene.UnregisterModuleInterface<IUserManagement>(this); 108 if (m_Enabled)
118 m_Scenes.Remove(scene); 109 {
110 scene.UnregisterModuleInterface<IUserManagement>(this);
111 m_Scenes.Remove(scene);
112 }
119 } 113 }
120 114
121 public void RegionLoaded(Scene s) 115 public void RegionLoaded(Scene s)
@@ -149,7 +143,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
149 143
150 void EventManager_OnNewClient(IClientAPI client) 144 void EventManager_OnNewClient(IClientAPI client)
151 { 145 {
146 client.OnConnectionClosed += new Action<IClientAPI>(HandleConnectionClosed);
152 client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest); 147 client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest);
148 client.OnAvatarPickerRequest += new AvatarPickerRequest(HandleAvatarPickerRequest);
149 }
150
151 void HandleConnectionClosed(IClientAPI client)
152 {
153 client.OnNameFromUUIDRequest -= new UUIDNameRequest(HandleUUIDNameRequest);
154 client.OnAvatarPickerRequest -= new AvatarPickerRequest(HandleAvatarPickerRequest);
153 } 155 }
154 156
155 void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client) 157 void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client)
@@ -170,6 +172,77 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
170 } 172 }
171 } 173 }
172 174
175 public void HandleAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query)
176 {
177 //EventManager.TriggerAvatarPickerRequest();
178
179 m_log.DebugFormat("[USER MANAGEMENT MODULE]: HandleAvatarPickerRequest for {0}", query);
180
181 List<UserAccount> accs = m_Scenes[0].UserAccountService.GetUserAccounts(m_Scenes[0].RegionInfo.ScopeID, query);
182
183 List<UserData> users = new List<UserData>();
184 if (accs != null)
185 {
186 foreach (UserAccount acc in accs)
187 {
188 UserData ud = new UserData();
189 ud.FirstName = acc.FirstName;
190 ud.LastName = acc.LastName;
191 ud.Id = acc.PrincipalID;
192 users.Add(ud);
193 }
194 }
195
196 AddAdditionalUsers(avatarID, query, users);
197
198 AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply);
199 // TODO: don't create new blocks if recycling an old packet
200
201 AvatarPickerReplyPacket.DataBlock[] searchData =
202 new AvatarPickerReplyPacket.DataBlock[users.Count];
203 AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock();
204
205 agentData.AgentID = avatarID;
206 agentData.QueryID = RequestID;
207 replyPacket.AgentData = agentData;
208 //byte[] bytes = new byte[AvatarResponses.Count*32];
209
210 int i = 0;
211 foreach (UserData item in users)
212 {
213 UUID translatedIDtem = item.Id;
214 searchData[i] = new AvatarPickerReplyPacket.DataBlock();
215 searchData[i].AvatarID = translatedIDtem;
216 searchData[i].FirstName = Utils.StringToBytes((string)item.FirstName);
217 searchData[i].LastName = Utils.StringToBytes((string)item.LastName);
218 i++;
219 }
220 if (users.Count == 0)
221 {
222 searchData = new AvatarPickerReplyPacket.DataBlock[0];
223 }
224 replyPacket.Data = searchData;
225
226 AvatarPickerReplyAgentDataArgs agent_data = new AvatarPickerReplyAgentDataArgs();
227 agent_data.AgentID = replyPacket.AgentData.AgentID;
228 agent_data.QueryID = replyPacket.AgentData.QueryID;
229
230 List<AvatarPickerReplyDataArgs> data_args = new List<AvatarPickerReplyDataArgs>();
231 for (i = 0; i < replyPacket.Data.Length; i++)
232 {
233 AvatarPickerReplyDataArgs data_arg = new AvatarPickerReplyDataArgs();
234 data_arg.AvatarID = replyPacket.Data[i].AvatarID;
235 data_arg.FirstName = replyPacket.Data[i].FirstName;
236 data_arg.LastName = replyPacket.Data[i].LastName;
237 data_args.Add(data_arg);
238 }
239 client.SendAvatarPickerReply(agent_data, data_args);
240 }
241
242 protected virtual void AddAdditionalUsers(UUID avatarID, string query, List<UserData> users)
243 {
244 }
245
173 #endregion Event Handlers 246 #endregion Event Handlers
174 247
175 private void CacheCreators(SceneObjectGroup sog) 248 private void CacheCreators(SceneObjectGroup sog)
@@ -226,7 +299,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
226 299
227 public string GetUserName(UUID uuid) 300 public string GetUserName(UUID uuid)
228 { 301 {
229 //m_log.DebugFormat("[XXX] GetUserName {0}", uuid);
230 string[] names = GetUserNames(uuid); 302 string[] names = GetUserNames(uuid);
231 if (names.Length == 2) 303 if (names.Length == 2)
232 { 304 {
@@ -267,9 +339,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
267 339
268 if (userdata.HomeURL != null && userdata.HomeURL != string.Empty) 340 if (userdata.HomeURL != null && userdata.HomeURL != string.Empty)
269 { 341 {
270 m_log.DebugFormat( 342 //m_log.DebugFormat(
271 "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}", 343 // "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}",
272 serverType, userdata.HomeURL, userID); 344 // serverType, userdata.HomeURL, userID);
273 345
274 UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); 346 UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
275 userdata.ServerURLs = uConn.GetServerURLs(userID); 347 userdata.ServerURLs = uConn.GetServerURLs(userID);
@@ -328,11 +400,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
328 400
329 public void AddUser(UUID uuid, string first, string last, string homeURL) 401 public void AddUser(UUID uuid, string first, string last, string homeURL)
330 { 402 {
403 // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL);
404
331 AddUser(uuid, homeURL + ";" + first + " " + last); 405 AddUser(uuid, homeURL + ";" + first + " " + last);
332 } 406 }
333 407
334 public void AddUser (UUID id, string creatorData) 408 public void AddUser (UUID id, string creatorData)
335 { 409 {
410 //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
411
336 UserData oldUser; 412 UserData oldUser;
337 //lock the whole block - prevent concurrent update 413 //lock the whole block - prevent concurrent update
338 lock (m_UserCache) 414 lock (m_UserCache)
@@ -358,9 +434,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
358 return; 434 return;
359 } 435 }
360 } 436 }
361// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
362 437
363 UserAccount account = m_Scenes [0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id); 438 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id);
364 439
365 if (account != null) 440 if (account != null)
366 { 441 {
@@ -409,9 +484,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
409 lock (m_UserCache) 484 lock (m_UserCache)
410 m_UserCache[user.Id] = user; 485 m_UserCache[user.Id] = user;
411 486
412// m_log.DebugFormat( 487 //m_log.DebugFormat(
413// "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", 488 // "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}",
414// user.Id, user.FirstName, user.LastName, user.HomeURL); 489 // user.Id, user.FirstName, user.LastName, user.HomeURL);
415 } 490 }
416 491
417 public bool IsLocalGridUser(UUID uuid) 492 public bool IsLocalGridUser(UUID uuid)
@@ -425,13 +500,23 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
425 500
426 #endregion IUserManagement 501 #endregion IUserManagement
427 502
503 protected void RegisterConsoleCmds()
504 {
505 MainConsole.Instance.Commands.AddCommand("Users", true,
506 "show names",
507 "show names",
508 "Show the bindings between user UUIDs and user names",
509 String.Empty,
510 HandleShowUsers);
511 }
512
428 private void HandleShowUsers(string module, string[] cmd) 513 private void HandleShowUsers(string module, string[] cmd)
429 { 514 {
430 lock (m_UserCache) 515 lock (m_UserCache)
431 { 516 {
432 if (m_UserCache.Count == 0) 517 if (m_UserCache.Count == 0)
433 { 518 {
434 MainConsole.Instance.Output("No users not found"); 519 MainConsole.Instance.Output("No users found");
435 return; 520 return;
436 } 521 }
437 522