void AvatarPropertiesRequestHandler(Packet packet, Agent agent) { AvatarPropertiesRequestPacket request = (AvatarPropertiesRequestPacket)packet; lock (Server.Agents) { foreach (Agent agt in Server.Agents.Values) { if (agent.AgentID == request.AgentData.AvatarID) { AvatarPropertiesReplyPacket reply = new AvatarPropertiesReplyPacket(); reply.AgentData.AgentID = agt.AgentID; reply.AgentData.AvatarID = request.AgentData.AvatarID; reply.PropertiesData.AboutText = Utils.StringToBytes("Profile info unavailable"); reply.PropertiesData.BornOn = Utils.StringToBytes("Unknown"); reply.PropertiesData.CharterMember = Utils.StringToBytes("Test User"); reply.PropertiesData.FLAboutText = Utils.StringToBytes("First life info unavailable"); reply.PropertiesData.Flags = 0; //TODO: at least generate static image uuids based on name. //this will prevent re-caching the default image for the same av name. reply.PropertiesData.FLImageID = agent.AgentID; //temporary hack reply.PropertiesData.ImageID = agent.AgentID; //temporary hack reply.PropertiesData.PartnerID = UUID.Zero; reply.PropertiesData.ProfileURL = Utils.StringToBytes(String.Empty); agent.SendPacket(reply); break; } } } }
void AvatarPropertiesRequestHandler(Packet packet, Agent agent) { AvatarPropertiesRequestPacket request = (AvatarPropertiesRequestPacket)packet; Agent foundAgent; if (server.Agents.TryGetValue(request.AgentData.AvatarID, out foundAgent)) { AvatarPropertiesReplyPacket reply = new AvatarPropertiesReplyPacket(); reply.AgentData.AgentID = agent.AgentID; reply.AgentData.AvatarID = request.AgentData.AvatarID; reply.PropertiesData.AboutText = Utils.StringToBytes(foundAgent.ProfileAboutText); reply.PropertiesData.BornOn = Utils.StringToBytes(foundAgent.ProfileBornOn); reply.PropertiesData.CharterMember = new byte[1]; reply.PropertiesData.FLAboutText = Utils.StringToBytes(foundAgent.ProfileFirstText); reply.PropertiesData.Flags = (uint)foundAgent.ProfileFlags; reply.PropertiesData.FLImageID = foundAgent.ProfileFirstImage; reply.PropertiesData.ImageID = foundAgent.ProfileImage; reply.PropertiesData.PartnerID = foundAgent.PartnerID; reply.PropertiesData.ProfileURL = Utils.StringToBytes(foundAgent.ProfileURL); server.UDP.SendPacket(agent.AgentID, reply, PacketCategory.Transaction); } else { Logger.Log("AvatarPropertiesRequest for unknown agent " + request.AgentData.AvatarID.ToString(), Helpers.LogLevel.Warning); } }
private Packet inAvatar(Packet packet, IPEndPoint sim) { AvatarPropertiesReplyPacket avr = (AvatarPropertiesReplyPacket)packet; if (avr.AgentData.AvatarID == frame.AgentID) { setData = true; form.setStuff(avr.PropertiesData.ImageID.ToString(), avr.PropertiesData.FLImageID.ToString(), Utils.BytesToString(avr.PropertiesData.AboutText), Utils.BytesToString(avr.PropertiesData.FLAboutText), Utils.BytesToString(avr.PropertiesData.ProfileURL)); } return(packet); }
private void AvatarPropertiesHandler(Packet packet, Simulator sim) { Avatar av; AvatarPropertiesReplyPacket reply = (AvatarPropertiesReplyPacket)packet; lock (Avatars) { if (!Avatars.ContainsKey(reply.AgentData.AvatarID)) { //not in our "cache", create a new object av = new Avatar(); } else { //Cache hit, modify existing avatar av = Avatars[reply.AgentData.AvatarID]; } av.ID = reply.AgentData.AvatarID; av.ProfileImage = reply.PropertiesData.ImageID; av.FirstLifeImage = reply.PropertiesData.FLImageID; av.PartnerID = reply.PropertiesData.PartnerID; av.AboutText = Helpers.FieldToString(reply.PropertiesData.AboutText); av.FirstLifeText = Helpers.FieldToString(reply.PropertiesData.FLAboutText); av.BornOn = Helpers.FieldToString(reply.PropertiesData.BornOn); av.CharterMember = Helpers.FieldToString(reply.PropertiesData.CharterMember); av.AllowPublish = reply.PropertiesData.AllowPublish; av.MaturePublish = reply.PropertiesData.MaturePublish; av.Identified = reply.PropertiesData.Identified; av.Transacted = reply.PropertiesData.Transacted; av.ProfileURL = Helpers.FieldToString(reply.PropertiesData.ProfileURL); //reassign in the cache Avatars[av.ID] = av; //Heaven forbid that we actually get a packet we didn't ask for. if (AvatarPropertiesCallbacks.ContainsKey(av.ID) && AvatarPropertiesCallbacks[av.ID] != null) { AvatarPropertiesCallbacks[av.ID](av); } } }
public void Avatars_OnAvatarProperties(Packet packet, Simulator sim) { Hashtable item = new Hashtable(); AvatarPropertiesReplyPacket reply = (AvatarPropertiesReplyPacket)packet; item.Add("MessageType", "AvatarProperties"); item.Add("AvatarID", reply.AgentData.AvatarID); item.Add("PartnerID", reply.PropertiesData.PartnerID); item.Add("AboutText", Helpers.FieldToUTF8String(reply.PropertiesData.AboutText)); item.Add("FirstLifeText", Helpers.FieldToUTF8String(reply.PropertiesData.FLAboutText)); item.Add("FirstLifeImage", reply.PropertiesData.FLImageID); item.Add("ProfileImage", reply.PropertiesData.ImageID); item.Add("ProfileURL", Helpers.FieldToUTF8String(reply.PropertiesData.ProfileURL)); item.Add("BornOn", Helpers.FieldToUTF8String(reply.PropertiesData.BornOn)); item.Add("CharterMember", Helpers.FieldToUTF8String(reply.PropertiesData.CharterMember)); item.Add("AllowPublish", reply.PropertiesData.Flags & (0x1 << 0)); item.Add("MaturePublish", reply.PropertiesData.Flags & (0x1 << 1)); item.Add("Identified", reply.PropertiesData.Flags & (0x1 << 2)); item.Add("Transacted", reply.PropertiesData.Flags & (0x1 << 3)); item.Add("Online", reply.PropertiesData.Flags & (0x1 << 4)); enqueue(item); }
public void Avatars_AvatarProperties(object sender, PacketReceivedEventArgs e) { Hashtable item = new Hashtable(); AvatarPropertiesReplyPacket reply = (AvatarPropertiesReplyPacket)e.Packet; item.Add("MessageType", "AvatarProperties"); item.Add("AvatarID", reply.AgentData.AvatarID); item.Add("PartnerID", reply.PropertiesData.PartnerID); item.Add("AboutText", Utils.BytesToString(reply.PropertiesData.AboutText)); item.Add("FirstLifeText", Utils.BytesToString(reply.PropertiesData.FLAboutText)); item.Add("FirstLifeImage", reply.PropertiesData.FLImageID); item.Add("ProfileImage", reply.PropertiesData.ImageID); item.Add("ProfileURL", Utils.BytesToString(reply.PropertiesData.ProfileURL)); item.Add("BornOn", Utils.BytesToString(reply.PropertiesData.BornOn)); item.Add("CharterMember", Utils.BytesToString(reply.PropertiesData.CharterMember)); item.Add("AllowPublish", reply.PropertiesData.Flags & (0x1 << 0)); item.Add("MaturePublish", reply.PropertiesData.Flags & (0x1 << 1)); item.Add("Identified", reply.PropertiesData.Flags & (0x1 << 2)); item.Add("Transacted", reply.PropertiesData.Flags & (0x1 << 3)); item.Add("Online", reply.PropertiesData.Flags & (0x1 << 4)); enqueue(item); }
private void SendAvatarProperties(LLAgent agent, UUID avatarID, User user) { AvatarPropertiesReplyPacket reply = new AvatarPropertiesReplyPacket(); reply.AgentData.AgentID = agent.ID; reply.AgentData.AvatarID = avatarID; // TODO: Check for ProfileFlags.Online (including permission check) ProfileFlags profileFlags = 0; if (user != null) { if (user.AccessLevel > 0) { profileFlags |= ProfileFlags.Identified; } reply.PropertiesData.AboutText = Utils.StringToBytes(user.GetField("About").AsString()); reply.PropertiesData.BornOn = Utils.StringToBytes(user.GetField("CreationDate").AsDate().ToString("M/d/yyyy", System.Globalization.CultureInfo.InvariantCulture)); reply.PropertiesData.CharterMember = (user.AccessLevel >= 200) ? Utils.StringToBytes("Operator") : Utils.EmptyBytes; reply.PropertiesData.FLAboutText = Utils.StringToBytes(user.GetField("FLAbout").AsString()); reply.PropertiesData.Flags = (uint)profileFlags; reply.PropertiesData.FLImageID = user.GetField("FLImage").AsUUID(); reply.PropertiesData.ImageID = user.GetField("Image").AsUUID(); reply.PropertiesData.PartnerID = user.GetField("Partner").AsUUID(); reply.PropertiesData.ProfileURL = Utils.StringToBytes(user.GetField("URL").AsString()); } else { reply.PropertiesData.AboutText = Utils.EmptyBytes; reply.PropertiesData.BornOn = Utils.EmptyBytes; reply.PropertiesData.CharterMember = Utils.EmptyBytes; reply.PropertiesData.FLAboutText = Utils.EmptyBytes; reply.PropertiesData.ProfileURL = Utils.EmptyBytes; } m_udp.SendPacket(agent, reply, ThrottleCategory.Task, false); }
/// <summary> /// Process incoming avatar properties (profile data) /// </summary> /// <param name="packet"></param> /// <param name="sim"></param> private void AvatarPropertiesHandler(Packet packet, Simulator sim) { if (OnAvatarProperties != null) { AvatarPropertiesReplyPacket reply = (AvatarPropertiesReplyPacket)packet; Avatar.Properties properties = new Avatar.Properties(); properties.ProfileImage = reply.PropertiesData.ImageID; properties.FirstLifeImage = reply.PropertiesData.FLImageID; properties.Partner = reply.PropertiesData.PartnerID; properties.AboutText = Helpers.FieldToString(reply.PropertiesData.AboutText); properties.FirstLifeText = Helpers.FieldToString(reply.PropertiesData.FLAboutText); properties.BornOn = Helpers.FieldToString(reply.PropertiesData.BornOn); properties.CharterMember = Helpers.FieldToString(reply.PropertiesData.CharterMember); properties.AllowPublish = reply.PropertiesData.AllowPublish; properties.MaturePublish = reply.PropertiesData.MaturePublish; properties.Identified = reply.PropertiesData.Identified; properties.Transacted = reply.PropertiesData.Transacted; properties.ProfileURL = Helpers.FieldToString(reply.PropertiesData.ProfileURL); OnAvatarProperties(reply.AgentData.AvatarID, properties); } }
/// <summary> /// Process incoming avatar properties (profile data) /// </summary> /// <param name="packet"></param> /// <param name="sim"></param> private void AvatarPropertiesHandler(Packet packet, Simulator sim) { if (OnAvatarProperties != null) { AvatarPropertiesReplyPacket reply = (AvatarPropertiesReplyPacket)packet; Avatar.AvatarProperties properties = new Avatar.AvatarProperties(); properties.ProfileImage = reply.PropertiesData.ImageID; properties.FirstLifeImage = reply.PropertiesData.FLImageID; properties.Partner = reply.PropertiesData.PartnerID; properties.AboutText = Helpers.FieldToUTF8String(reply.PropertiesData.AboutText); properties.FirstLifeText = Helpers.FieldToUTF8String(reply.PropertiesData.FLAboutText); properties.BornOn = Helpers.FieldToUTF8String(reply.PropertiesData.BornOn); //properties.CharterMember = Helpers.FieldToUTF8String(reply.PropertiesData.CharterMember); uint charter = Helpers.BytesToUInt(reply.PropertiesData.CharterMember); if (charter == 0) { properties.CharterMember = "Resident"; } else if (charter == 2) { properties.CharterMember = "Charter"; } else if (charter == 3) { properties.CharterMember = "Linden"; } else { properties.CharterMember = Helpers.FieldToUTF8String(reply.PropertiesData.CharterMember); } properties.Flags = (Avatar.ProfileFlags)reply.PropertiesData.Flags; properties.ProfileURL = Helpers.FieldToUTF8String(reply.PropertiesData.ProfileURL); OnAvatarProperties(reply.AgentData.AvatarID, properties); } }
private void SendAvatarProperties(LLAgent agent, UUID avatarID, User user) { AvatarPropertiesReplyPacket reply = new AvatarPropertiesReplyPacket(); reply.AgentData.AgentID = agent.ID; reply.AgentData.AvatarID = avatarID; // TODO: Check for ProfileFlags.Online (including permission check) ProfileFlags profileFlags = 0; if (user != null) { if (user.AccessLevel > 0) profileFlags |= ProfileFlags.Identified; reply.PropertiesData.AboutText = Utils.StringToBytes(user.GetField("About").AsString()); reply.PropertiesData.BornOn = Utils.StringToBytes(user.GetField("CreationDate").AsDate().ToString("M/d/yyyy", System.Globalization.CultureInfo.InvariantCulture)); reply.PropertiesData.CharterMember = (user.AccessLevel >= 200) ? Utils.StringToBytes("Operator") : Utils.EmptyBytes; reply.PropertiesData.FLAboutText = Utils.StringToBytes(user.GetField("FLAbout").AsString()); reply.PropertiesData.Flags = (uint)profileFlags; reply.PropertiesData.FLImageID = user.GetField("FLImage").AsUUID(); reply.PropertiesData.ImageID = user.GetField("Image").AsUUID(); reply.PropertiesData.PartnerID = user.GetField("Partner").AsUUID(); reply.PropertiesData.ProfileURL = Utils.StringToBytes(user.GetField("URL").AsString()); } else { reply.PropertiesData.AboutText = Utils.EmptyBytes; reply.PropertiesData.BornOn = Utils.EmptyBytes; reply.PropertiesData.CharterMember = Utils.EmptyBytes; reply.PropertiesData.FLAboutText = Utils.EmptyBytes; reply.PropertiesData.ProfileURL = Utils.EmptyBytes; } m_udp.SendPacket(agent, reply, ThrottleCategory.Task, false); }