private OSDMap UserAccount2InfoWebOSD(UserAccount user)
{
OSDMap resp = new OSDMap();
IAgentInfoService agentService = m_registry.RequestModuleInterface<IAgentInfoService>();
UserInfo userinfo = agentService.GetUserInfo(user.PrincipalID.ToString());
IGridService gs = m_registry.RequestModuleInterface<IGridService>();
GridRegion homeRegion = null;
GridRegion currentRegion = null;
if (userinfo != null)
{
homeRegion = gs.GetRegionByUUID(null, userinfo.HomeRegionID);
currentRegion = userinfo.CurrentRegionID != UUID.Zero ? gs.GetRegionByUUID(null, userinfo.CurrentRegionID) : null;
}
resp["UUID"] = OSD.FromUUID(user.PrincipalID);
resp["HomeUUID"] = OSD.FromUUID((homeRegion == null) ? UUID.Zero : homeRegion.RegionID);
resp["HomeName"] = OSD.FromString((homeRegion == null) ? "" : homeRegion.RegionName);
resp["CurrentRegionUUID"] = OSD.FromUUID((currentRegion == null) ? UUID.Zero : currentRegion.RegionID);
resp["CurrentRegionName"] = OSD.FromString((currentRegion == null) ? "" : currentRegion.RegionName);
resp["Online"] = OSD.FromBoolean((userinfo == null) ? false : userinfo.IsOnline);
resp["Email"] = OSD.FromString(user.Email);
resp["Name"] = OSD.FromString(user.Name);
resp["FirstName"] = OSD.FromString(user.FirstName);
resp["LastName"] = OSD.FromString(user.LastName);
resp["LastLogin"] = userinfo == null ? OSD.FromBoolean(false) : OSD.FromInteger((int)Utils.DateTimeToUnixTime(userinfo.LastLogin));
resp["LastLogout"] = userinfo == null ? OSD.FromBoolean(false) : OSD.FromInteger((int)Utils.DateTimeToUnixTime(userinfo.LastLogout));
return resp;
}