123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750 |
- /*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Reflection;
- using System.Threading;
- using OpenSim.Framework;
- using OpenSim.Framework.Console;
- using OpenSim.Framework.Monitoring;
- using OpenSim.Region.ClientStack.LindenUDP;
- using OpenSim.Region.Framework;
- using OpenSim.Region.Framework.Interfaces;
- using OpenSim.Region.Framework.Scenes;
- using OpenSim.Services.Interfaces;
- using OpenSim.Services.Connectors.Hypergrid;
- using OpenMetaverse;
- using OpenMetaverse.Packets;
- using log4net;
- using Nini.Config;
- using Mono.Addins;
- using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags;
- namespace OpenSim.Region.CoreModules.Framework.UserManagement
- {
- [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UserManagementModule")]
- public class UserManagementModule : ISharedRegionModule, IUserManagement, IPeople
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- protected bool m_Enabled;
- protected List<Scene> m_Scenes = new List<Scene>();
- protected IServiceThrottleModule m_ServiceThrottle;
- // The cache
- protected Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>();
- #region ISharedRegionModule
- public void Initialise(IConfigSource config)
- {
- string umanmod = config.Configs["Modules"].GetString("UserManagementModule", Name);
- if (umanmod == Name)
- {
- m_Enabled = true;
- Init();
- m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name);
- }
- }
- public bool IsSharedModule
- {
- get { return true; }
- }
- public virtual string Name
- {
- get { return "BasicUserManagementModule"; }
- }
- public Type ReplaceableInterface
- {
- get { return null; }
- }
- public void AddRegion(Scene scene)
- {
- if (m_Enabled)
- {
- m_Scenes.Add(scene);
- scene.RegisterModuleInterface<IUserManagement>(this);
- scene.RegisterModuleInterface<IPeople>(this);
- scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient);
- scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded);
- }
- }
- public void RemoveRegion(Scene scene)
- {
- if (m_Enabled)
- {
- scene.UnregisterModuleInterface<IUserManagement>(this);
- m_Scenes.Remove(scene);
- }
- }
- public void RegionLoaded(Scene s)
- {
- if (m_Enabled && m_ServiceThrottle == null)
- m_ServiceThrottle = s.RequestModuleInterface<IServiceThrottleModule>();
- }
- public void PostInitialise()
- {
- }
- public void Close()
- {
- m_Scenes.Clear();
- lock (m_UserCache)
- m_UserCache.Clear();
- }
- #endregion ISharedRegionModule
-
- #region Event Handlers
- void EventManager_OnPrimsLoaded(Scene s)
- {
- // let's sniff all the user names referenced by objects in the scene
- m_log.DebugFormat("[USER MANAGEMENT MODULE]: Caching creators' data from {0} ({1} objects)...", s.RegionInfo.RegionName, s.GetEntities().Length);
- s.ForEachSOG(delegate(SceneObjectGroup sog) { CacheCreators(sog); });
- }
- void EventManager_OnNewClient(IClientAPI client)
- {
- client.OnConnectionClosed += new Action<IClientAPI>(HandleConnectionClosed);
- client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest);
- client.OnAvatarPickerRequest += new AvatarPickerRequest(HandleAvatarPickerRequest);
- }
- void HandleConnectionClosed(IClientAPI client)
- {
- client.OnNameFromUUIDRequest -= new UUIDNameRequest(HandleUUIDNameRequest);
- client.OnAvatarPickerRequest -= new AvatarPickerRequest(HandleAvatarPickerRequest);
- }
- void HandleUUIDNameRequest(UUID uuid, IClientAPI client)
- {
- // m_log.DebugFormat(
- // "[USER MANAGEMENT MODULE]: Handling request for name binding of UUID {0} from {1}",
- // uuid, remote_client.Name);
- if (m_Scenes[0].LibraryService != null && (m_Scenes[0].LibraryService.LibraryRootFolder.Owner == uuid))
- {
- client.SendNameReply(uuid, "Mr", "OpenSim");
- }
- else
- {
- string[] names = new string[2];
- if (TryGetUserNamesFromCache(uuid, names))
- {
- client.SendNameReply(uuid, names[0], names[1]);
- return;
- }
- // Not found in cache, queue continuation
- m_ServiceThrottle.Enqueue("name", uuid.ToString(), delegate
- {
- //m_log.DebugFormat("[YYY]: Name request {0}", uuid);
- // As least upto September 2013, clients permanently cache UUID -> Name bindings. Some clients
- // appear to clear this when the user asks it to clear the cache, but others may not.
- //
- // So to avoid clients
- // (particularly Hypergrid clients) permanently binding "Unknown User" to a given UUID, we will
- // instead drop the request entirely.
- if (TryGetUserNames(uuid, names))
- client.SendNameReply(uuid, names[0], names[1]);
- // else
- // m_log.DebugFormat(
- // "[USER MANAGEMENT MODULE]: No bound name for {0} found, ignoring request from {1}",
- // uuid, client.Name);
- });
- }
- }
- public void HandleAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query)
- {
- //EventManager.TriggerAvatarPickerRequest();
- m_log.DebugFormat("[USER MANAGEMENT MODULE]: HandleAvatarPickerRequest for {0}", query);
- List<UserData> users = GetUserData(query, 500, 1);
- AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply);
- // TODO: don't create new blocks if recycling an old packet
- AvatarPickerReplyPacket.DataBlock[] searchData =
- new AvatarPickerReplyPacket.DataBlock[users.Count];
- AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock();
- agentData.AgentID = avatarID;
- agentData.QueryID = RequestID;
- replyPacket.AgentData = agentData;
- //byte[] bytes = new byte[AvatarResponses.Count*32];
- int i = 0;
- foreach (UserData item in users)
- {
- UUID translatedIDtem = item.Id;
- searchData[i] = new AvatarPickerReplyPacket.DataBlock();
- searchData[i].AvatarID = translatedIDtem;
- searchData[i].FirstName = Utils.StringToBytes((string)item.FirstName);
- searchData[i].LastName = Utils.StringToBytes((string)item.LastName);
- i++;
- }
- if (users.Count == 0)
- {
- searchData = new AvatarPickerReplyPacket.DataBlock[0];
- }
- replyPacket.Data = searchData;
- AvatarPickerReplyAgentDataArgs agent_data = new AvatarPickerReplyAgentDataArgs();
- agent_data.AgentID = replyPacket.AgentData.AgentID;
- agent_data.QueryID = replyPacket.AgentData.QueryID;
- List<AvatarPickerReplyDataArgs> data_args = new List<AvatarPickerReplyDataArgs>();
- for (i = 0; i < replyPacket.Data.Length; i++)
- {
- AvatarPickerReplyDataArgs data_arg = new AvatarPickerReplyDataArgs();
- data_arg.AvatarID = replyPacket.Data[i].AvatarID;
- data_arg.FirstName = replyPacket.Data[i].FirstName;
- data_arg.LastName = replyPacket.Data[i].LastName;
- data_args.Add(data_arg);
- }
- client.SendAvatarPickerReply(agent_data, data_args);
- }
- protected virtual void AddAdditionalUsers(string query, List<UserData> users)
- {
- }
- #endregion Event Handlers
- #region IPeople
- public List<UserData> GetUserData(string query, int page_size, int page_number)
- {
- // search the user accounts service
- List<UserAccount> accs = m_Scenes[0].UserAccountService.GetUserAccounts(m_Scenes[0].RegionInfo.ScopeID, query);
- List<UserData> users = new List<UserData>();
- if (accs != null)
- {
- foreach (UserAccount acc in accs)
- {
- UserData ud = new UserData();
- ud.FirstName = acc.FirstName;
- ud.LastName = acc.LastName;
- ud.Id = acc.PrincipalID;
- users.Add(ud);
- }
- }
- // search the local cache
- lock (m_UserCache)
- {
- foreach (UserData data in m_UserCache.Values)
- {
- if (data.Id != UUID.Zero &&
- users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null &&
- (data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower())))
- users.Add(data);
- }
- }
- AddAdditionalUsers(query, users);
- return users;
- }
- #endregion IPeople
- private void CacheCreators(SceneObjectGroup sog)
- {
- //m_log.DebugFormat("[USER MANAGEMENT MODULE]: processing {0} {1}; {2}", sog.RootPart.Name, sog.RootPart.CreatorData, sog.RootPart.CreatorIdentification);
- AddUser(sog.RootPart.CreatorID, sog.RootPart.CreatorData);
- foreach (SceneObjectPart sop in sog.Parts)
- {
- AddUser(sop.CreatorID, sop.CreatorData);
- foreach (TaskInventoryItem item in sop.TaskInventory.Values)
- AddUser(item.CreatorID, item.CreatorData);
- }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="uuid"></param>
- /// <param name="names">Caller please provide a properly instantiated array for names, string[2]</param>
- /// <returns></returns>
- private bool TryGetUserNames(UUID uuid, string[] names)
- {
- if (names == null)
- names = new string[2];
- if (TryGetUserNamesFromCache(uuid, names))
- return true;
- if (TryGetUserNamesFromServices(uuid, names))
- return true;
- return false;
- }
- private bool TryGetUserNamesFromCache(UUID uuid, string[] names)
- {
- lock (m_UserCache)
- {
- if (m_UserCache.ContainsKey(uuid))
- {
- names[0] = m_UserCache[uuid].FirstName;
- names[1] = m_UserCache[uuid].LastName;
- return true;
- }
- }
- return false;
- }
- /// <summary>
- /// Try to get the names bound to the given uuid, from the services.
- /// </summary>
- /// <returns>True if the name was found, false if not.</returns>
- /// <param name='uuid'></param>
- /// <param name='names'>The array of names if found. If not found, then names[0] = "Unknown" and names[1] = "User"</param>
- private bool TryGetUserNamesFromServices(UUID uuid, string[] names)
- {
- UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, uuid);
- if (account != null)
- {
- names[0] = account.FirstName;
- names[1] = account.LastName;
- UserData user = new UserData();
- user.FirstName = account.FirstName;
- user.LastName = account.LastName;
- lock (m_UserCache)
- m_UserCache[uuid] = user;
- return true;
- }
- else
- {
- // Let's try the GridUser service
- GridUserInfo uInfo = m_Scenes[0].GridUserService.GetGridUserInfo(uuid.ToString());
- if (uInfo != null)
- {
- string url, first, last, tmp;
- UUID u;
- if (Util.ParseUniversalUserIdentifier(uInfo.UserID, out u, out url, out first, out last, out tmp))
- {
- AddUser(uuid, first, last, url);
- if (m_UserCache.ContainsKey(uuid))
- {
- names[0] = m_UserCache[uuid].FirstName;
- names[1] = m_UserCache[uuid].LastName;
- return true;
- }
- }
- else
- m_log.DebugFormat("[USER MANAGEMENT MODULE]: Unable to parse UUI {0}", uInfo.UserID);
- }
- else
- {
- m_log.DebugFormat("[USER MANAGEMENT MODULE]: No grid user found for {0}", uuid);
- }
- names[0] = "Unknown";
- names[1] = "UserUMMTGUN9";
- return false;
- }
- }
- #region IUserManagement
- public UUID GetUserIdByName(string name)
- {
- string[] parts = name.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
- if (parts.Length < 2)
- throw new Exception("Name must have 2 components");
- return GetUserIdByName(parts[0], parts[1]);
- }
- public UUID GetUserIdByName(string firstName, string lastName)
- {
- // TODO: Optimize for reverse lookup if this gets used by non-console commands.
- lock (m_UserCache)
- {
- foreach (UserData user in m_UserCache.Values)
- {
- if (user.FirstName == firstName && user.LastName == lastName)
- return user.Id;
- }
- }
- UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName);
- if (account != null)
- return account.PrincipalID;
- return UUID.Zero;
- }
- public string GetUserName(UUID uuid)
- {
- string[] names = new string[2];
- TryGetUserNames(uuid, names);
- return names[0] + " " + names[1];
- }
- public string GetUserHomeURL(UUID userID)
- {
- lock (m_UserCache)
- {
- if (m_UserCache.ContainsKey(userID))
- return m_UserCache[userID].HomeURL;
- }
- return string.Empty;
- }
- public string GetUserServerURL(UUID userID, string serverType)
- {
- UserData userdata;
- lock (m_UserCache)
- m_UserCache.TryGetValue(userID, out userdata);
- if (userdata != null)
- {
- // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID);
- if (userdata.ServerURLs != null)
- {
- object url;
- if (userdata.ServerURLs.TryGetValue(serverType, out url))
- return url.ToString();
- }
- else if (!string.IsNullOrEmpty(userdata.HomeURL))
- {
- //m_log.DebugFormat(
- // "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}",
- // serverType, userdata.HomeURL, userID);
- UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
- try
- {
- userdata.ServerURLs = uConn.GetServerURLs(userID);
- }
- catch (Exception e)
- {
- m_log.Debug("[USER MANAGEMENT MODULE]: GetServerURLs call failed ", e);
- userdata.ServerURLs = new Dictionary<string, object>();
- }
- object url;
- if (userdata.ServerURLs.TryGetValue(serverType, out url))
- return url.ToString();
- }
- }
- return string.Empty;
- }
- public string GetUserUUI(UUID userID)
- {
- UserData ud;
- lock (m_UserCache)
- m_UserCache.TryGetValue(userID, out ud);
- if (ud == null) // It's not in the cache
- {
- string[] names = new string[2];
- // This will pull the data from either UserAccounts or GridUser
- // and stick it into the cache
- TryGetUserNamesFromServices(userID, names);
- lock (m_UserCache)
- m_UserCache.TryGetValue(userID, out ud);
- }
- if (ud != null)
- {
- string homeURL = ud.HomeURL;
- string first = ud.FirstName, last = ud.LastName;
- if (ud.LastName.StartsWith("@"))
- {
- string[] parts = ud.FirstName.Split('.');
- if (parts.Length >= 2)
- {
- first = parts[0];
- last = parts[1];
- }
- return userID + ";" + homeURL + ";" + first + " " + last;
- }
- }
- return userID.ToString();
- }
- public void AddUser(UUID uuid, string first, string last)
- {
- lock (m_UserCache)
- {
- if (m_UserCache.ContainsKey(uuid))
- return;
- }
- UserData user = new UserData();
- user.Id = uuid;
- user.FirstName = first;
- user.LastName = last;
- AddUserInternal(user);
- }
- public void AddUser(UUID uuid, string first, string last, string homeURL)
- {
- //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL);
- if (homeURL == string.Empty)
- return;
- AddUser(uuid, homeURL + ";" + first + " " + last);
- }
- public void AddUser(UUID id, string creatorData)
- {
- //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
- UserData oldUser;
- lock (m_UserCache)
- m_UserCache.TryGetValue(id, out oldUser);
- if (oldUser != null)
- {
- if (string.IsNullOrEmpty(creatorData))
- {
- //ignore updates without creator data
- return;
- }
- //try update unknown users, but don't update anyone else
- if (oldUser.FirstName == "Unknown" && !creatorData.Contains("Unknown"))
- {
- lock (m_UserCache)
- m_UserCache.Remove(id);
- m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData, oldUser.HomeURL);
- }
- else
- {
- //we have already a valid user within the cache
- return;
- }
- }
- UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id);
- if (account != null)
- {
- AddUser(id, account.FirstName, account.LastName);
- }
- else
- {
- UserData user = new UserData();
- user.Id = id;
- if (!string.IsNullOrEmpty(creatorData))
- {
- //creatorData = <endpoint>;<name>
- string[] parts = creatorData.Split(';');
- if (parts.Length >= 2)
- user.FirstName = parts[1].Replace(' ', '.');
- if (parts.Length >= 1)
- {
- user.HomeURL = parts[0];
- try
- {
- Uri uri = new Uri(parts[0]);
- user.LastName = "@" + uri.Authority;
- }
- catch (UriFormatException)
- {
- m_log.DebugFormat(
- "[USER MANAGEMENT MODULE]: Unable to parse home URL {0} for user name {1}, ID {2} from original creator data {3} when adding user info.",
- parts[0], user.FirstName ?? "Unknown", id, creatorData);
- user.LastName = "@unknown";
- }
- }
- }
- else
- {
- // Temporarily add unknown user entries of this type into the cache so that we can distinguish
- // this source from other recent (hopefully resolved) bugs that fail to retrieve a user name binding
- // TODO: Can be removed when GUN* unknown users have definitely dropped significantly or
- // disappeared.
- user.FirstName = "Unknown";
- user.LastName = "UserUMMAU4";
- }
-
- AddUserInternal(user);
- }
- }
- void AddUserInternal(UserData user)
- {
- lock (m_UserCache)
- m_UserCache[user.Id] = user;
- //m_log.DebugFormat(
- // "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}",
- // user.Id, user.FirstName, user.LastName, user.HomeURL);
- }
- public bool IsLocalGridUser(UUID uuid)
- {
- UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
- if (account == null || (account != null && !account.LocalToGrid))
- return false;
- return true;
- }
- #endregion IUserManagement
- protected void Init()
- {
- AddUser(UUID.Zero, "Unknown", "User");
- RegisterConsoleCmds();
- }
- protected void RegisterConsoleCmds()
- {
- MainConsole.Instance.Commands.AddCommand("Users", true,
- "show name",
- "show name <uuid>",
- "Show the bindings between a single user UUID and a user name",
- String.Empty,
- HandleShowUser);
- MainConsole.Instance.Commands.AddCommand("Users", true,
- "show names",
- "show names",
- "Show the bindings between user UUIDs and user names",
- String.Empty,
- HandleShowUsers);
- MainConsole.Instance.Commands.AddCommand("Users", true,
- "reset user cache",
- "reset user cache",
- "reset user cache to allow changed settings to be applied",
- String.Empty,
- HandleResetUserCache);
- }
- private void HandleResetUserCache(string module, string[] cmd)
- {
- lock(m_UserCache)
- {
- m_UserCache.Clear();
- }
- }
- private void HandleShowUser(string module, string[] cmd)
- {
- if (cmd.Length < 3)
- {
- MainConsole.Instance.OutputFormat("Usage: show name <uuid>");
- return;
- }
- UUID userId;
- if (!ConsoleUtil.TryParseConsoleUuid(MainConsole.Instance, cmd[2], out userId))
- return;
- UserData ud;
- lock (m_UserCache)
- {
- if (!m_UserCache.TryGetValue(userId, out ud))
- {
- MainConsole.Instance.OutputFormat("No name known for user with id {0}", userId);
- return;
- }
- }
- ConsoleDisplayTable cdt = new ConsoleDisplayTable();
- cdt.AddColumn("UUID", 36);
- cdt.AddColumn("Name", 30);
- cdt.AddColumn("HomeURL", 40);
- cdt.AddRow(userId, string.Format("{0} {1}", ud.FirstName, ud.LastName), ud.HomeURL);
- MainConsole.Instance.Output(cdt.ToString());
- }
- private void HandleShowUsers(string module, string[] cmd)
- {
- ConsoleDisplayTable cdt = new ConsoleDisplayTable();
- cdt.AddColumn("UUID", 36);
- cdt.AddColumn("Name", 30);
- cdt.AddColumn("HomeURL", 40);
- lock (m_UserCache)
- {
- foreach (KeyValuePair<UUID, UserData> kvp in m_UserCache)
- cdt.AddRow(kvp.Key, string.Format("{0} {1}", kvp.Value.FirstName, kvp.Value.LastName), kvp.Value.HomeURL);
- }
- MainConsole.Instance.Output(cdt.ToString());
- }
- }
- }
|