private void SendProfile(IClientAPI remoteClient, IUserProfileInfo Profile, UUID target, uint agentOnline) { UserAccount account = GetRegionUserIsIn(remoteClient.AgentId).UserAccountService.GetUserAccount(UUID.Zero, target); if (Profile == null || account == null) return; Byte[] charterMember; if (Profile.MembershipGroup == "") { charterMember = new Byte[1]; charterMember[0] = (Byte)((account.UserFlags & 0xf00) >> 8); } else { charterMember = OpenMetaverse.Utils.StringToBytes(Profile.MembershipGroup); } uint membershipGroupINT = 0; if (Profile.MembershipGroup != "") membershipGroupINT = 4; uint flags = Convert.ToUInt32(Profile.AllowPublish) + Convert.ToUInt32(Profile.MaturePublish) + membershipGroupINT + (uint)agentOnline + (uint)account.UserFlags; remoteClient.SendAvatarInterestsReply(target, Convert.ToUInt32(Profile.Interests.WantToMask), Profile.Interests.WantToText, Convert.ToUInt32(Profile.Interests.CanDoMask), Profile.Interests.CanDoText, Profile.Interests.Languages); remoteClient.SendAvatarProperties(account.PrincipalID, Profile.AboutText, Util.ToDateTime(account.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture), charterMember, Profile.FirstLifeAboutText, flags, Profile.FirstLifeImage, Profile.Image, Profile.WebURL, new UUID(Profile.Partner)); }
public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { IScene s = remoteClient.Scene; if (!(s is Scene)) return; // Scene scene = (Scene)s; string profileUrl = String.Empty; string aboutText = String.Empty; string firstLifeAboutText = String.Empty; UUID image = UUID.Zero; UUID firstLifeImage = UUID.Zero; UUID partner = UUID.Zero; uint wantMask = 0; string wantText = String.Empty; uint skillsMask = 0; string skillsText = String.Empty; string languages = String.Empty; UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, avatarID); string name = "Avatar"; int created = 0; if (account != null) { name = account.FirstName + " " + account.LastName; created = account.Created; } Byte[] charterMember = Utils.StringToBytes(name); profileUrl = "No profile data"; aboutText = string.Empty; firstLifeAboutText = string.Empty; image = UUID.Zero; firstLifeImage = UUID.Zero; partner = UUID.Zero; remoteClient.SendAvatarProperties(avatarID, aboutText, Util.ToDateTime(created).ToString( "M/d/yyyy", CultureInfo.InvariantCulture), charterMember, firstLifeAboutText, (uint)(0 & 0xff), firstLifeImage, image, profileUrl, partner); //Viewer expects interest data when it asks for properties. remoteClient.SendAvatarInterestsReply(avatarID, wantMask, wantText, skillsMask, skillsText, languages); }
public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { if (String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString())) { // Looking for a reason that some viewers are sending null Id's m_log.DebugFormat("[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID); return; } // Can't handle NPC yet... ScenePresence p = FindPresence(avatarID); if (null != p) { if (p.PresenceType == PresenceType.Npc) return; } string serverURI = string.Empty; bool foreign = GetUserProfileServerURI(avatarID, out serverURI); UserAccount account = null; Dictionary<string,object> userInfo; if (!foreign) { account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, avatarID); } else { userInfo = new Dictionary<string, object>(); } Byte[] charterMember = new Byte[1]; string born = String.Empty; uint flags = 0x00; if (null != account) { if (account.UserTitle == "") { charterMember[0] = (Byte)((account.UserFlags & 0xf00) >> 8); } else { charterMember = Utils.StringToBytes(account.UserTitle); } born = Util.ToDateTime(account.Created).ToString( "M/d/yyyy", CultureInfo.InvariantCulture); flags = (uint)(account.UserFlags & 0xff); } else { if (GetUserAccountData(avatarID, out userInfo) == true) { if ((string)userInfo["user_title"] == "") { charterMember[0] = (Byte)(((Byte)userInfo["user_flags"] & 0xf00) >> 8); } else { charterMember = Utils.StringToBytes((string)userInfo["user_title"]); } int val_born = (int)userInfo["user_created"]; born = Util.ToDateTime(val_born).ToString( "M/d/yyyy", CultureInfo.InvariantCulture); // picky, picky int val_flags = (int)userInfo["user_flags"]; flags = (uint)(val_flags & 0xff); } } UserProfileProperties props = new UserProfileProperties(); string result = string.Empty; props.UserId = avatarID; if (!GetProfileData(ref props, foreign, out result)) { m_log.DebugFormat("Error getting profile for {0}: {1}", avatarID, result); return; } remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, charterMember , props.FirstLifeText, flags, props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); remoteClient.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, props.WantToText, (uint)props.SkillsMask, props.SkillsText, props.Language); }
public void RequestAvatarProperty(IClientAPI remoteClient, UUID target) { IUserProfileInfo UPI = ProfileFrontend.GetUserProfile(target); if (UPI == null) return; OpenSim.Services.Interfaces.GridUserInfo TargetPI = GetRegionUserIsIn(remoteClient.AgentId).GridUserService.GetGridUserInfo(target.ToString()); bool isFriend = IsFriendOfUser(remoteClient.AgentId, target); if (isFriend) { uint agentOnline = 0; if (TargetPI != null && TargetPI.Online) { agentOnline = 16; } SendProfile(remoteClient, UPI, target, agentOnline); } else { UserAccount TargetAccount = GetRegionUserIsIn(remoteClient.AgentId).UserAccountService.GetUserAccount(UUID.Zero, target); //See if all can see this person //Not a friend, so send the first page only and if they are online uint agentOnline = 0; if (TargetPI != null && TargetPI.Online && UPI.Visible) { agentOnline = 16; } Byte[] charterMember; if (UPI.MembershipGroup == "") { charterMember = new Byte[1]; charterMember[0] = (Byte)((TargetAccount.UserFlags & 0xf00) >> 8); } else { charterMember = OpenMetaverse.Utils.StringToBytes(UPI.MembershipGroup); } remoteClient.SendAvatarProperties(UPI.PrincipalID, "", Util.ToDateTime(UPI.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture), charterMember, "", (uint)(TargetAccount.UserFlags & agentOnline), UUID.Zero, UUID.Zero, "", UUID.Zero); } }
public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { if (String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString())) { // Looking for a reason that some viewers are sending null Id's m_log.DebugFormat("[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID); return; } // Can't handle NPC yet... ScenePresence p = FindPresence(avatarID); if (null != p) { if (p.PresenceType == PresenceType.Npc) { return; } } string serverURI = string.Empty; bool foreign = GetUserProfileServerURI(avatarID, out serverURI); UserAccount account = null; Dictionary <string, object> userInfo; if (!foreign) { account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, avatarID); } else { userInfo = new Dictionary <string, object>(); } Byte[] charterMember = new Byte[1]; string born = String.Empty; uint flags = 0x00; if (null != account) { if (account.UserTitle == "") { charterMember[0] = (Byte)((account.UserFlags & 0xf00) >> 8); } else { charterMember = Utils.StringToBytes(account.UserTitle); } born = Util.ToDateTime(account.Created).ToString( "M/d/yyyy", CultureInfo.InvariantCulture); flags = (uint)(account.UserFlags & 0xff); } else { if (GetUserAccountData(avatarID, out userInfo) == true) { if ((string)userInfo["user_title"] == "") { charterMember[0] = (Byte)(((Byte)userInfo["user_flags"] & 0xf00) >> 8); } else { charterMember = Utils.StringToBytes((string)userInfo["user_title"]); } int val_born = (int)userInfo["user_created"]; born = Util.ToDateTime(val_born).ToString( "M/d/yyyy", CultureInfo.InvariantCulture); // picky, picky int val_flags = (int)userInfo["user_flags"]; flags = (uint)(val_flags & 0xff); } } UserProfileProperties props = new UserProfileProperties(); string result = string.Empty; props.UserId = avatarID; GetProfileData(ref props, out result); remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, charterMember, props.FirstLifeText, flags, props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); remoteClient.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, props.WantToText, (uint)props.SkillsMask, props.SkillsText, props.Language); }
/////////////////////////////////////////////////////////////////////////////////////////////// // // Profile // // Request profile and Interests public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { IScene s = remoteClient.Scene; if (!(s is Scene)) return; Scene scene = (Scene)s; UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, avatarID); if (null != account) { Byte[] charterMember; if (account.UserTitle == "") { charterMember = new Byte[1]; charterMember[0] = (Byte)((account.UserFlags & 0xf00) >> 8); } else { charterMember = Utils.StringToBytes(account.UserTitle); } //Hashtable profileData = GetProfileData(remoteClient.AgentId); Hashtable profileData = GetProfileData(avatarID); string profileUrl = String.Empty; string aboutText = String.Empty; string firstLifeText = String.Empty; string timeformat = "M/d/yyyy"; UUID firstLifeImage = UUID.Zero; UUID image = UUID.Zero; UUID partner = UUID.Zero; int userFlags = 0; if (profileData["Partner"] != null) partner = new UUID(profileData["Partner"].ToString()); if (profileData["ProfileUrl"] != null) profileUrl = profileData["ProfileUrl"].ToString(); if (profileData["Image"] != null) image = new UUID(profileData["Image"].ToString()); if (profileData["AboutText"] != null) aboutText = profileData["AboutText"].ToString(); if (profileData["FirstLifeImage"] != null) firstLifeImage = new UUID(profileData["FirstLifeImage"].ToString()); if (profileData["FirstLifeText"] != null) firstLifeText = profileData["FirstLifeText"].ToString(); if (profileData["UserFlags"] != null) userFlags = int.Parse(profileData["UserFlags"].ToString()); if (Enc!=null) { aboutText = Enc.GetString(Convert.FromBase64String(aboutText)); firstLifeText = Enc.GetString(Convert.FromBase64String(firstLifeText)); } account.UserFlags &= ~0x03; account.UserFlags |= userFlags; remoteClient.SendAvatarProperties(avatarID, aboutText, Util.ToDateTime(account.Created).ToString(timeformat, CultureInfo.InvariantCulture), charterMember, firstLifeText, (uint)(account.UserFlags & 0xff), firstLifeImage, image, profileUrl, partner); //////////////////////////////////////////////////////////////////////////////////////////////////////// // Request Interests string wantoText = String.Empty; string skillText = String.Empty; string langText = String.Empty; uint wantoMask = 0; uint skillMask = 0; if (profileData["WantToMask"] != null) wantoMask = Convert.ToUInt32(profileData["WantToMask"]); if (profileData["WantToText"] != null) wantoText = profileData["WantToText"].ToString(); if (profileData["SkillsMask"] != null) skillMask = Convert.ToUInt32(profileData["SkillsMask"]); if (profileData["SkillsText"] != null) skillText = profileData["SkillsText"].ToString(); if (profileData["LanguagesText"] != null) langText = profileData["LanguagesText"].ToString(); if (Enc!=null) { wantoText = Enc.GetString(Convert.FromBase64String(wantoText)); skillText = Enc.GetString(Convert.FromBase64String(skillText)); langText = Enc.GetString(Convert.FromBase64String(langText)); } remoteClient.SendAvatarInterestsReply(avatarID, wantoMask, wantoText, skillMask, skillText, langText); } else { m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString()); } }
/// <summary> /// /// </summary> /// <param name="remoteClient"></param> /// <param name="avatarID"></param> public void RequestAvatarProperty(IClientAPI remoteClient, UUID avatarID) { // FIXME: finish adding fields such as url, masking, etc. UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(avatarID); if (null != profile) { Byte[] charterMember; if (profile.CustomType == "") { charterMember = new Byte[1]; charterMember[0] = (Byte)((profile.UserFlags & 0xf00) >> 8); } else { charterMember = Utils.StringToBytes(profile.CustomType); } if (m_profileModule != null) { Hashtable profileData = m_profileModule.GetProfileData(remoteClient.AgentId); if (profileData["ProfileUrl"] != null) profile.ProfileUrl = profileData["ProfileUrl"].ToString(); } remoteClient.SendAvatarProperties(profile.ID, profile.AboutText, Util.ToDateTime(profile.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture), charterMember, profile.FirstLifeAboutText, (uint)(profile.UserFlags & 0xff), profile.FirstLifeImage, profile.Image, profile.ProfileUrl, profile.Partner); } else { m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString()); } }
public void RequestAvatarProperty(IClientAPI remoteClient, UUID target) { IUserProfileInfo UPI = ProfileFrontend.GetUserProfile(target); if (UPI == null) { remoteClient.SendAvatarProperties(target, "", Util.ToDateTime(0).ToString("M/d/yyyy", CultureInfo.InvariantCulture), new Byte[1], "", 0, UUID.Zero, UUID.Zero, "", UUID.Zero); return; } UserInfo TargetPI = remoteClient.Scene.RequestModuleInterface<IAgentInfoService>().GetUserInfo(target.ToString()); //See if all can see this person uint agentOnline = 0; if (TargetPI != null && TargetPI.IsOnline && UPI.Visible) agentOnline = 16; UserAccount TargetAccount = remoteClient.Scene.UserAccountService.GetUserAccount(UUID.Zero, target); if (IsFriendOfUser(remoteClient.AgentId, target)) SendProfile(remoteClient, UPI, TargetAccount, agentOnline); else { //Not a friend, so send the first page only and if they are online Byte[] charterMember; if (UPI.MembershipGroup == "") { charterMember = new Byte[1]; charterMember[0] = (Byte) ((TargetAccount.UserFlags & 0xf00) >> 8); } else { charterMember = Utils.StringToBytes(UPI.MembershipGroup); } remoteClient.SendAvatarProperties(UPI.PrincipalID, UPI.AboutText, Util.ToDateTime(UPI.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture), charterMember, UPI.FirstLifeAboutText, (uint) (TargetAccount.UserFlags & agentOnline), UPI.FirstLifeImage, UPI.Image, UPI.WebURL, UPI.Partner); } }
private void SendProfile(IClientAPI remoteClient, IUserProfileInfo Profile, UserAccount account, uint agentOnline) { Byte[] charterMember; if (Profile.MembershipGroup == "") { charterMember = new Byte[1]; if (account != null) charterMember[0] = (Byte) ((account.UserFlags & Constants.USER_FLAG_CHARTERMEMBER) >> 8); // CharterMember == 0xf00 } else charterMember = Utils.StringToBytes(Profile.MembershipGroup); // When ChaterMember set this character └ the viewer recognizes it // as a Grid Master Not sure what we will be doing with this in // in Virtual Universe. // Perhaps the Viewer Development Work Group on the Second Galaxy Development Team // will shed some light on this regarding future viewer planning. if (Utilities.IsSystemUser(Profile.PrincipalID)) { charterMember = Utils.StringToBytes("└"); } uint membershipGroupINT = 0; if (Profile.MembershipGroup != "") membershipGroupINT = 4; uint flags = Convert.ToUInt32(Profile.AllowPublish) + Convert.ToUInt32(Profile.MaturePublish) + membershipGroupINT + agentOnline + (uint) (account != null ? account.UserFlags : 0); remoteClient.SendAvatarInterestsReply(Profile.PrincipalID, Convert.ToUInt32(Profile.Interests.WantToMask), Profile.Interests.WantToText, Convert.ToUInt32(Profile.Interests.CanDoMask), Profile.Interests.CanDoText, Profile.Interests.Languages); remoteClient.SendAvatarProperties(Profile.PrincipalID, Profile.AboutText, Util.ToDateTime(Profile.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture), charterMember, Profile.FirstLifeAboutText, flags, Profile.FirstLifeImage, Profile.Image, Profile.WebURL, Profile.Partner); }
public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { IScene s = remoteClient.Scene; if (!(s is Scene)) return; Scene scene = (Scene)s; UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, avatarID); if (null != account) { Byte[] charterMember; if (account.UserTitle == "") { charterMember = new Byte[1]; charterMember[0] = (Byte)((account.UserFlags & 0xf00) >> 8); } else { charterMember = Utils.StringToBytes(account.UserTitle); } Hashtable profileData = GetProfileData(avatarID); string profileUrl = String.Empty; string aboutText = String.Empty; string firstLifeAboutText = String.Empty; UUID image = UUID.Zero; UUID firstLifeImage = UUID.Zero; UUID partner = UUID.Zero; uint wantMask = 0; string wantText = String.Empty; uint skillsMask = 0; string skillsText = String.Empty; string languages = String.Empty; if (profileData["ProfileUrl"] != null) profileUrl = profileData["ProfileUrl"].ToString(); if (profileData["AboutText"] != null) aboutText = profileData["AboutText"].ToString(); if (profileData["FirstLifeAboutText"] != null) firstLifeAboutText = profileData["FirstLifeAboutText"].ToString(); if (profileData["Image"] != null) image = new UUID(profileData["Image"].ToString()); if (profileData["FirstLifeImage"] != null) firstLifeImage = new UUID(profileData["FirstLifeImage"].ToString()); if (profileData["Partner"] != null) partner = new UUID(profileData["Partner"].ToString()); // The PROFILE information is no longer stored in the user // account. It now needs to be taken from the XMLRPC // remoteClient.SendAvatarProperties(avatarID, aboutText, Util.ToDateTime(account.Created).ToString( "M/d/yyyy", CultureInfo.InvariantCulture), charterMember, firstLifeAboutText, (uint)(account.UserFlags & 0xff), firstLifeImage, image, profileUrl, partner); //Viewer expects interest data when it asks for properties. if (profileData["wantmask"] != null) wantMask = Convert.ToUInt32(profileData["wantmask"].ToString()); if (profileData["wanttext"] != null) wantText = profileData["wanttext"].ToString(); if (profileData["skillsmask"] != null) skillsMask = Convert.ToUInt32(profileData["skillsmask"].ToString()); if (profileData["skillstext"] != null) skillsText = profileData["skillstext"].ToString(); if (profileData["languages"] != null) languages = profileData["languages"].ToString(); remoteClient.SendAvatarInterestsReply(avatarID, wantMask, wantText, skillsMask, skillsText, languages); } else { m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString()); } }
/// <summary> /// /// </summary> /// <param name="remoteClient"></param> /// <param name="avatarID"></param> public void RequestAvatarProperty(IClientAPI remoteClient, UUID avatarID) { UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(avatarID); if (null != profile) { Byte[] charterMember; if (String.IsNullOrEmpty(profile.CustomType)) { charterMember = new Byte[1]; charterMember[0] = (Byte)((profile.UserFlags & 0xf00) >> 8); } else { charterMember = Utils.StringToBytes(profile.CustomType); } remoteClient.SendAvatarProperties(profile.ID, profile.AboutText, Util.UnixToLocalDateTime(profile.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture), charterMember, profile.FirstLifeAboutText, (uint)(profile.UserFlags & 0xff), profile.FirstLifeImage, profile.Image, profile.ProfileURL, profile.Partner); } else { m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString()); } }
public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { if ( String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString())) { // Looking for a reason that some viewers are sending null Id's m_log.InfoFormat("[PROFILE]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID); return; } // Can't handle NPC yet... ScenePresence p = FindPresence(avatarID); if (null != p) { if (p.PresenceType == PresenceType.Npc) return; } IScene s = remoteClient.Scene; if (!(s is Scene)) return; Scene scene = (Scene)s; string serverURI = string.Empty; bool foreign = GetUserProfileServerURI(avatarID, out serverURI); UserAccount account = null; Dictionary<string,object> userInfo; if (!foreign) { account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, avatarID); } else { userInfo = new Dictionary<string, object>(); } Byte[] charterMember = new Byte[1]; string born = String.Empty; uint flags = 0x00; if (null != account) { if (account.UserTitle == "") { charterMember[0] = (Byte)((account.UserFlags & 0xf00) >> 8); } else { charterMember = Utils.StringToBytes(account.UserTitle); } born = Util.ToDateTime(account.Created).ToString( "M/d/yyyy", CultureInfo.InvariantCulture); flags = (uint)(account.UserFlags & 0xff); } else { if (GetUserProfileData(avatarID, out userInfo) == true) { if ((string)userInfo["user_title"] == "") { charterMember[0] = (Byte)(((Byte)userInfo["user_flags"] & 0xf00) >> 8); } else { charterMember = Utils.StringToBytes((string)userInfo["user_title"]); } int val_born = (int)userInfo["user_created"]; born = Util.ToDateTime(val_born).ToString( "M/d/yyyy", CultureInfo.InvariantCulture); // picky, picky int val_flags = (int)userInfo["user_flags"]; flags = (uint)(val_flags & 0xff); } } Hashtable profileData = GetProfileData(avatarID); string profileUrl = string.Empty; string aboutText = String.Empty; string firstLifeAboutText = String.Empty; UUID image = UUID.Zero; UUID firstLifeImage = UUID.Zero; UUID partner = UUID.Zero; uint wantMask = 0; string wantText = String.Empty; uint skillsMask = 0; string skillsText = String.Empty; string languages = String.Empty; if (profileData["ProfileUrl"] != null) profileUrl = profileData["ProfileUrl"].ToString(); if (profileData["AboutText"] != null) aboutText = profileData["AboutText"].ToString(); if (profileData["FirstLifeAboutText"] != null) firstLifeAboutText = profileData["FirstLifeAboutText"].ToString(); if (profileData["Image"] != null) image = new UUID(profileData["Image"].ToString()); if (profileData["FirstLifeImage"] != null) firstLifeImage = new UUID(profileData["FirstLifeImage"].ToString()); if (profileData["Partner"] != null) partner = new UUID(profileData["Partner"].ToString()); // The PROFILE information is no longer stored in the user // account. It now needs to be taken from the XMLRPC // remoteClient.SendAvatarProperties(avatarID, aboutText,born, charterMember, firstLifeAboutText, flags, firstLifeImage, image, profileUrl, partner); //Viewer expects interest data when it asks for properties. if (profileData["wantmask"] != null) wantMask = Convert.ToUInt32(profileData["wantmask"].ToString()); if (profileData["wanttext"] != null) wantText = profileData["wanttext"].ToString(); if (profileData["skillsmask"] != null) skillsMask = Convert.ToUInt32(profileData["skillsmask"].ToString()); if (profileData["skillstext"] != null) skillsText = profileData["skillstext"].ToString(); if (profileData["languages"] != null) languages = profileData["languages"].ToString(); remoteClient.SendAvatarInterestsReply(avatarID, wantMask, wantText, skillsMask, skillsText, languages); }
private void RequestAvatarPropertiesHandler(IClientAPI client, UUID avatarID) { m_log.DebugFormat("[SIMIAN PROFILES]: Request avatar properties for {0}", avatarID); OSDMap user = FetchUserData(avatarID); ProfileFlags flags = ProfileFlags.AllowPublish | ProfileFlags.MaturePublish; if (user != null) { OSDMap about = null; if (user.ContainsKey("LLAbout")) { try { about = OSDParser.DeserializeJson(user["LLAbout"].AsString()) as OSDMap; } catch { m_log.WarnFormat("[SIMIAN PROFILES]: Unable to decode LLAbout"); } } if (about == null) { about = new OSDMap(0); } // Check if this user is a grid operator byte[] charterMember; if (user["AccessLevel"].AsInteger() >= 200) { charterMember = Utils.StringToBytes("Operator"); } else { charterMember = Utils.EmptyBytes; } // Check if the user is online if (client.Scene is Scene) { OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() }); if (presences != null && presences.Length > 0) { flags |= ProfileFlags.Online; } } // Check if the user is identified if (user["Identified"].AsBoolean()) { flags |= ProfileFlags.Identified; } client.SendAvatarProperties(avatarID, about["About"].AsString(), user["CreationDate"].AsDate().ToString("M/d/yyyy", System.Globalization.CultureInfo.InvariantCulture), charterMember, about["FLAbout"].AsString(), (uint)flags, about["FLImage"].AsUUID(), about["Image"].AsUUID(), about["URL"].AsString(), user["Partner"].AsUUID()); OSDMap interests = null; if (user.ContainsKey("LLInterests")) { try { interests = OSDParser.DeserializeJson(user["LLInterests"].AsString()) as OSDMap; client.SendAvatarInterestsReply(avatarID, interests["WantMask"].AsUInteger(), interests["WantText"].AsString(), interests["SkillsMask"].AsUInteger(), interests["SkillsText"].AsString(), interests["Languages"].AsString()); } catch { } } if (about == null) { about = new OSDMap(0); } } else { m_log.Warn("[SIMIAN PROFILES]: Failed to fetch profile information for " + client.Name + ", returning default values"); client.SendAvatarProperties(avatarID, String.Empty, "1/1/1970", Utils.EmptyBytes, String.Empty, (uint)flags, UUID.Zero, UUID.Zero, String.Empty, UUID.Zero); } }
private void RequestAvatarPropertiesHandler(IClientAPI client, UUID avatarID) { m_log.DebugFormat("[SIMIAN PROFILES]: Request avatar properties for {0}",avatarID); OSDMap user = FetchUserData(avatarID); ProfileFlags flags = ProfileFlags.AllowPublish | ProfileFlags.MaturePublish; if (user != null) { OSDMap about = null; if (user.ContainsKey("LLAbout")) { try { about = OSDParser.DeserializeJson(user["LLAbout"].AsString()) as OSDMap; } catch { m_log.WarnFormat("[SIMIAN PROFILES]: Unable to decode LLAbout"); } } if (about == null) about = new OSDMap(0); // Check if this user is a grid operator byte[] charterMember; if (user["AccessLevel"].AsInteger() >= 200) charterMember = Utils.StringToBytes("Operator"); else charterMember = Utils.EmptyBytes; // Check if the user is online if (client.Scene is Scene) { OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() }); if (presences != null && presences.Length > 0) flags |= ProfileFlags.Online; } // Check if the user is identified if (user["Identified"].AsBoolean()) flags |= ProfileFlags.Identified; client.SendAvatarProperties(avatarID, about["About"].AsString(), user["CreationDate"].AsDate().ToString("M/d/yyyy", System.Globalization.CultureInfo.InvariantCulture), charterMember, about["FLAbout"].AsString(), (uint)flags, about["FLImage"].AsUUID(), about["Image"].AsUUID(), about["URL"].AsString(), user["Partner"].AsUUID()); OSDMap interests = null; if (user.ContainsKey("LLInterests")) { try { interests = OSDParser.DeserializeJson(user["LLInterests"].AsString()) as OSDMap; client.SendAvatarInterestsReply(avatarID, interests["WantMask"].AsUInteger(), interests["WantText"].AsString(), interests["SkillsMask"].AsUInteger(), interests["SkillsText"].AsString(), interests["Languages"].AsString()); } catch { } } if (about == null) about = new OSDMap(0); } else { m_log.Warn("[SIMIAN PROFILES]: Failed to fetch profile information for " + client.Name + ", returning default values"); client.SendAvatarProperties(avatarID, String.Empty, "1/1/1970", Utils.EmptyBytes, String.Empty, (uint)flags, UUID.Zero, UUID.Zero, String.Empty, UUID.Zero); } }
public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { if (String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString())) { // Looking for a reason that some viewers are sending null Id's m_log.DebugFormat("[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID); return; } ScenePresence p = FindPresence(avatarID); if (p != null && p.isNPC) { remoteClient.SendAvatarProperties(avatarID, ((INPC)(p.ControllingClient)).profileAbout, ((INPC)(p.ControllingClient)).Born, Utils.StringToBytes("Non Player Character (NPC)"), "NPCs have no life", 0x10, UUID.Zero, ((INPC)(p.ControllingClient)).profileImage, "", UUID.Zero); remoteClient.SendAvatarInterestsReply(avatarID, 0, "", 0, "Getting into trouble", "Droidspeak"); return; } UserProfileProperties props; UserProfileCacheEntry uce = null; lock(m_profilesCache) { if(m_profilesCache.TryGetValue(avatarID, out uce) && uce != null) { if(uce.props != null) { props = uce.props; uint cflags = uce.flags; // if on same region force online if(p != null && !p.IsDeleted) cflags |= 0x10; remoteClient.SendAvatarProperties(props.UserId, props.AboutText, uce.born, uce.membershipType , props.FirstLifeText, cflags, props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); remoteClient.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, props.WantToText, (uint)props.SkillsMask, props.SkillsText, props.Language); return; } else { if(uce.ClientsWaitingProps == null) uce.ClientsWaitingProps = new HashSet<IClientAPI>(); else if(uce.ClientsWaitingProps.Contains(remoteClient)) return; uce.ClientsWaitingProps.Add(remoteClient); } } else { uce = new UserProfileCacheEntry(); uce.ClientsWaitingProps = new HashSet<IClientAPI>(); uce.ClientsWaitingProps.Add(remoteClient); m_profilesCache.AddOrUpdate(avatarID, uce, PROFILECACHEEXPIRE); } } string serverURI = string.Empty; bool foreign = GetUserProfileServerURI(avatarID, out serverURI); UserAccount account = null; Dictionary<string,object> userInfo; if (!foreign) { account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, avatarID); } else { userInfo = new Dictionary<string, object>(); } Byte[] membershipType = new Byte[1]; string born = string.Empty; uint flags = 0x00; if (null != account) { if (account.UserTitle == "") membershipType[0] = (Byte)((account.UserFlags & 0xf00) >> 8); else membershipType = Utils.StringToBytes(account.UserTitle); born = Util.ToDateTime(account.Created).ToString( "M/d/yyyy", CultureInfo.InvariantCulture); flags = (uint)(account.UserFlags & 0xff); } else { if (GetUserAccountData(avatarID, out userInfo) == true) { if ((string)userInfo["user_title"] == "") membershipType[0] = (Byte)(((Byte)userInfo["user_flags"] & 0xf00) >> 8); else membershipType = Utils.StringToBytes((string)userInfo["user_title"]); int val_born = (int)userInfo["user_created"]; if(val_born != 0) born = Util.ToDateTime(val_born).ToString( "M/d/yyyy", CultureInfo.InvariantCulture); // picky, picky int val_flags = (int)userInfo["user_flags"]; flags = (uint)(val_flags & 0xff); } } props = new UserProfileProperties(); props.UserId = avatarID; string result = string.Empty; if(!GetProfileData(ref props, foreign, serverURI, out result)) { props.AboutText ="Profile not available at this time. User may still be unknown to this grid"; } if(!m_allowUserProfileWebURLs) props.WebUrl =""; HashSet<IClientAPI> clients; lock(m_profilesCache) { if(!m_profilesCache.TryGetValue(props.UserId, out uce) || uce == null) uce = new UserProfileCacheEntry(); uce.props = props; uce.born = born; uce.membershipType = membershipType; uce.flags = flags; clients = uce.ClientsWaitingProps; uce.ClientsWaitingProps = null; m_profilesCache.AddOrUpdate(props.UserId, uce, PROFILECACHEEXPIRE); } // if on same region force online if(p != null && !p.IsDeleted) flags |= 0x10; if(clients == null) { remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags, props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); remoteClient.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, props.WantToText, (uint)props.SkillsMask, props.SkillsText, props.Language); } else { if(!clients.Contains(remoteClient)) clients.Add(remoteClient); foreach(IClientAPI cli in clients) { if(!cli.IsActive) continue; cli.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags, props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); cli.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, props.WantToText, (uint)props.SkillsMask, props.SkillsText, props.Language); } } }
void SendProfile(IClientAPI remoteClient, IUserProfileInfo Profile, UserAccount account, uint agentOnline) { Byte[] charterMember; if (Profile.MembershipGroup == "") { charterMember = new Byte[1]; if (account != null) charterMember [0] = (Byte)((account.UserFlags & Constants.USER_FLAG_CHARTERMEMBER) >> 8); // CharterMember == 0xf00 } else charterMember = Utils.StringToBytes (Profile.MembershipGroup); // 19-06-2015 Fly-Man- // When charterMember set this character └ the viewer recognizes it // as a Grid Master. Not sure what we want to do with that in WhiteCore // // Perhaps a talk with viewer devs to allow more options for this // if (Utilities.IsSystemUser (Profile.PrincipalID)) { charterMember = Utils.StringToBytes ("└"); } uint membershipGroupINT = 0; if (Profile.MembershipGroup != "") membershipGroupINT = 4; uint flags = Convert.ToUInt32 (Profile.AllowPublish) + Convert.ToUInt32 (Profile.MaturePublish) + membershipGroupINT + agentOnline + (uint)(account != null ? account.UserFlags : 0); remoteClient.SendAvatarInterestsReply ( Profile.PrincipalID, Convert.ToUInt32 (Profile.Interests.WantToMask), Profile.Interests.WantToText, Convert.ToUInt32 (Profile.Interests.CanDoMask), Profile.Interests.CanDoText, Profile.Interests.Languages ); remoteClient.SendAvatarProperties ( Profile.PrincipalID, Profile.AboutText, Util.ToDateTime (Profile.Created).ToString ("M/d/yyyy", CultureInfo.InvariantCulture), charterMember, Profile.FirstLifeAboutText, flags, Profile.FirstLifeImage, Profile.Image, Profile.WebURL, Profile.Partner ); }
public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { IScene s = remoteClient.Scene; if (!(s is Scene)) return; Scene scene = (Scene)s; string profileUrl = String.Empty; string aboutText = String.Empty; string firstLifeAboutText = String.Empty; UUID image = UUID.Zero; UUID firstLifeImage = UUID.Zero; UUID partner = UUID.Zero; uint wantMask = 0; string wantText = String.Empty; uint skillsMask = 0; string skillsText = String.Empty; string languages = String.Empty; Byte[] charterMember = Utils.StringToBytes("Avatar"); profileUrl = "No profile data"; aboutText = string.Empty; firstLifeAboutText = string.Empty; image = UUID.Zero; firstLifeImage = UUID.Zero; partner = UUID.Zero; remoteClient.SendAvatarProperties(avatarID, aboutText, Util.ToDateTime(0).ToString( "M/d/yyyy", CultureInfo.InvariantCulture), charterMember, firstLifeAboutText, (uint)(0 & 0xff), firstLifeImage, image, profileUrl, partner); //Viewer expects interest data when it asks for properties. remoteClient.SendAvatarInterestsReply(avatarID, wantMask, wantText, skillsMask, skillsText, languages); }
private void SendProfile(IClientAPI remoteClient, IUserProfileInfo Profile, UserAccount account, uint agentOnline) { Byte[] charterMember; if (Profile.MembershipGroup == "") { charterMember = new Byte[1]; charterMember[0] = (Byte) ((account.UserFlags & 0xf00) >> 8); } else charterMember = Utils.StringToBytes(Profile.MembershipGroup); uint membershipGroupINT = 0; if (Profile.MembershipGroup != "") membershipGroupINT = 4; uint flags = Convert.ToUInt32(Profile.AllowPublish) + Convert.ToUInt32(Profile.MaturePublish) + membershipGroupINT + agentOnline + (uint) account.UserFlags; remoteClient.SendAvatarInterestsReply(account.PrincipalID, Convert.ToUInt32(Profile.Interests.WantToMask), Profile.Interests.WantToText, Convert.ToUInt32(Profile.Interests.CanDoMask), Profile.Interests.CanDoText, Profile.Interests.Languages); remoteClient.SendAvatarProperties(account.PrincipalID, Profile.AboutText, Util.ToDateTime(account.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture), charterMember, Profile.FirstLifeAboutText, flags, Profile.FirstLifeImage, Profile.Image, Profile.WebURL, new UUID(Profile.Partner)); }
public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { IScene s = remoteClient.Scene; if (!(s is Scene)) { return; } Scene scene = (Scene)s; UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, avatarID); if (null != account) { Byte[] charterMember; if (account.UserTitle == "") { charterMember = new Byte[1]; charterMember[0] = (Byte)((account.UserFlags & 0xf00) >> 8); } else { charterMember = Utils.StringToBytes(account.UserTitle); } Hashtable profileData = GetProfileData(avatarID); string profileUrl = String.Empty; string aboutText = String.Empty; string firstLifeAboutText = String.Empty; UUID image = UUID.Zero; UUID firstLifeImage = UUID.Zero; UUID partner = UUID.Zero; uint wantMask = 0; string wantText = String.Empty; uint skillsMask = 0; string skillsText = String.Empty; string languages = String.Empty; if (profileData["ProfileUrl"] != null) { profileUrl = profileData["ProfileUrl"].ToString(); } if (profileData["AboutText"] != null) { aboutText = profileData["AboutText"].ToString(); } if (profileData["FirstLifeAboutText"] != null) { firstLifeAboutText = profileData["FirstLifeAboutText"].ToString(); } if (profileData["Image"] != null) { image = new UUID(profileData["Image"].ToString()); } if (profileData["FirstLifeImage"] != null) { firstLifeImage = new UUID(profileData["FirstLifeImage"].ToString()); } if (profileData["Partner"] != null) { partner = new UUID(profileData["Partner"].ToString()); } // The PROFILE information is no longer stored in the user // account. It now needs to be taken from the XMLRPC // remoteClient.SendAvatarProperties(avatarID, aboutText, Util.ToDateTime(account.Created).ToString( "M/d/yyyy", CultureInfo.InvariantCulture), charterMember, firstLifeAboutText, (uint)(account.UserFlags & 0xff), firstLifeImage, image, profileUrl, partner); //Viewer expects interest data when it asks for properties. if (profileData["wantmask"] != null) { wantMask = Convert.ToUInt32(profileData["wantmask"].ToString()); } if (profileData["wanttext"] != null) { wantText = profileData["wanttext"].ToString(); } if (profileData["skillsmask"] != null) { skillsMask = Convert.ToUInt32(profileData["skillsmask"].ToString()); } if (profileData["skillstext"] != null) { skillsText = profileData["skillstext"].ToString(); } if (profileData["languages"] != null) { languages = profileData["languages"].ToString(); } remoteClient.SendAvatarInterestsReply(avatarID, wantMask, wantText, skillsMask, skillsText, languages); } else { m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString()); } }