public OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map["X"]      = OSD.FromInteger((int)x);
            map["Y"]      = OSD.FromInteger((int)y);
            map["ID"]     = OSD.FromUUID(id);
            map["Name"]   = OSD.FromString(name);
            map["Extra"]  = OSD.FromInteger(Extra);
            map["Extra2"] = OSD.FromInteger(Extra2);
            return(map);
        }
Exemplo n.º 2
0
        void StoreMaterialsForPart(ISceneChildEntity part)
        {
            try {
                if (part == null || part.Shape == null)
                {
                    return;
                }

                Dictionary <UUID, OSDMap> mats = new Dictionary <UUID, OSDMap> ();

                Primitive.TextureEntry te = part.Shape.Textures;

                if (te.DefaultTexture != null)
                {
                    if (m_knownMaterials.ContainsKey(te.DefaultTexture.MaterialID))
                    {
                        mats [te.DefaultTexture.MaterialID] = m_knownMaterials [te.DefaultTexture.MaterialID];
                    }
                }

                if (te.FaceTextures != null)
                {
                    foreach (var face in te.FaceTextures)
                    {
                        if (face != null)
                        {
                            if (m_knownMaterials.ContainsKey(face.MaterialID))
                            {
                                mats [face.MaterialID] = m_knownMaterials [face.MaterialID];
                            }
                        }
                    }
                }
                if (mats.Count == 0)
                {
                    return;
                }

                OSDArray matsArr = new OSDArray();
                foreach (KeyValuePair <UUID, OSDMap> kvp in mats)
                {
                    OSDMap matOsd = new OSDMap();
                    matOsd ["ID"]       = OSD.FromUUID(kvp.Key);
                    matOsd ["Material"] = kvp.Value;
                    matsArr.Add(matOsd);
                }

                lock (_lock)
                    part.RenderMaterials = matsArr;
            } catch (Exception e) {
                MainConsole.Instance.Warn("[Materials]: exception in StoreMaterialsForPart(): " + e);
            }
        }
Exemplo n.º 3
0
        public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt,
                                      IPEndPoint newRegionExternalEndPoint,
                                      string capsURL, UUID agentID, UUID sessionID)
        {
            OSDArray lookAtArr = new OSDArray(3);

            lookAtArr.Add(OSD.FromReal(lookAt.X));
            lookAtArr.Add(OSD.FromReal(lookAt.Y));
            lookAtArr.Add(OSD.FromReal(lookAt.Z));

            OSDArray positionArr = new OSDArray(3);

            positionArr.Add(OSD.FromReal(pos.X));
            positionArr.Add(OSD.FromReal(pos.Y));
            positionArr.Add(OSD.FromReal(pos.Z));

            OSDMap infoMap = new OSDMap(2);

            infoMap.Add("LookAt", lookAtArr);
            infoMap.Add("Position", positionArr);

            OSDArray infoArr = new OSDArray(1);

            infoArr.Add(infoMap);

            OSDMap agentDataMap = new OSDMap(2);

            agentDataMap.Add("AgentID", OSD.FromUUID(agentID));
            agentDataMap.Add("SessionID", OSD.FromUUID(sessionID));

            OSDArray agentDataArr = new OSDArray(1);

            agentDataArr.Add(agentDataMap);

            OSDMap regionDataMap = new OSDMap(4);

            regionDataMap.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(handle)));
            regionDataMap.Add("SeedCapability", OSD.FromString(capsURL));
            regionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes()));
            regionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port));

            OSDArray regionDataArr = new OSDArray(1);

            regionDataArr.Add(regionDataMap);

            OSDMap llsdBody = new OSDMap(3);

            llsdBody.Add("Info", infoArr);
            llsdBody.Add("AgentData", agentDataArr);
            llsdBody.Add("RegionData", regionDataArr);

            return(buildEvent("CrossedRegion", llsdBody));
        }
        OSDMap CheckIfUserExists(OSDMap map)
        {
            IUserAccountService accountService = m_registry.RequestModuleInterface <IUserAccountService> ();
            UserAccount         user           = accountService.GetUserAccount(null, map ["Name"].AsString());

            bool   Verified = user != null;
            OSDMap resp     = new OSDMap();

            resp ["Verified"] = OSD.FromBoolean(Verified);
            resp ["UUID"]     = OSD.FromUUID(Verified ? user.PrincipalID : UUID.Zero);
            return(resp);
        }
Exemplo n.º 5
0
        public void SerializeUUID()
        {
            OSD llsdAUUID = OSD.FromUUID(new UUID("97f4aeca-88a1-42a1-b385-b97b18abb255"));

            byte[] binaryAUUIDSerialized = OSDParser.SerializeLLSDBinary(llsdAUUID);
            Assert.AreEqual(binaryAUUID, binaryAUUIDSerialized);

            OSD llsdZeroUUID = OSD.FromUUID(new UUID("00000000-0000-0000-0000-000000000000"));

            byte[] binaryZeroUUIDSerialized = OSDParser.SerializeLLSDBinary(llsdZeroUUID);
            Assert.AreEqual(binaryZeroUUID, binaryZeroUUIDSerialized);
        }
        protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
            m_log.DebugFormat("[GET_DISPLAY_NAMES]: called {0}", httpRequest.Url.Query);

            NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);

            string[] ids = query.GetValues("ids");


            if (m_UserManagement == null)
            {
                m_log.Error("[GET_DISPLAY_NAMES]: Cannot fetch display names without a user management component");
                httpResponse.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
                return(new byte[0]);
            }

            OSDMap   osdReply = new OSDMap();
            OSDArray agents   = new OSDArray();

            osdReply["agents"] = agents;
            foreach (string id in ids)
            {
                UUID uuid = UUID.Zero;
                if (UUID.TryParse(id, out uuid))
                {
                    string name = m_UserManagement.GetUserName(uuid);
                    if (!string.IsNullOrEmpty(name))
                    {
                        string[] parts   = name.Split(new char[] { ' ' });
                        OSDMap   osdname = new OSDMap();
                        osdname["display_name_next_update"] = OSD.FromDate(DateTime.MinValue);
                        osdname["display_name_expires"]     = OSD.FromDate(DateTime.Now.AddMonths(1));
                        osdname["display_name"]             = OSD.FromString(name);
                        osdname["legacy_first_name"]        = parts[0];
                        osdname["legacy_last_name"]         = parts[1];
                        osdname["username"] = OSD.FromString(name);
                        osdname["id"]       = OSD.FromUUID(uuid);
                        osdname["is_display_name_default"] = OSD.FromBoolean(true);

                        agents.Add(osdname);
                    }
                }
            }

            // Full content request
            httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
            //httpResponse.ContentLength = ??;
            httpResponse.ContentType = "application/llsd+xml";

            string reply = OSDParser.SerializeLLSDXmlString(osdReply);

            return(System.Text.Encoding.UTF8.GetBytes(reply));
        }
Exemplo n.º 7
0
        OSDMap GroupNotices(OSDMap map)
        {
            var resp = new OSDMap();

            resp ["GroupNotices"] = new OSDArray();
            resp ["Total"]        = 0;
            var groups = DataPlugins.RequestPlugin <IGroupsServiceConnector> ();

            if (map.ContainsKey("Groups") && groups != null && map ["Groups"].Type.ToString() == "Array")
            {
                var groupIDs = (OSDArray)map ["Groups"];
                var GroupIDs = new List <UUID> ();
                foreach (string groupID in groupIDs)
                {
                    UUID foo;
                    if (UUID.TryParse(groupID, out foo))
                    {
                        GroupIDs.Add(foo);
                    }
                }
                if (GroupIDs.Count > 0)
                {
                    var start           = map.ContainsKey("Start") ? uint.Parse(map ["Start"]) : 0;
                    var count           = map.ContainsKey("Count") ? uint.Parse(map ["Count"]) : 10;
                    var groupNoticeList = groups.GetGroupNotices(AdminAgentID, start, count, GroupIDs);
                    var groupNotices    = new OSDArray(groupNoticeList.Count);

                    foreach (GroupNoticeData GND in groupNoticeList)
                    {
                        var gnd = new OSDMap();

                        gnd ["GroupID"]       = OSD.FromUUID(GND.GroupID);
                        gnd ["NoticeID"]      = OSD.FromUUID(GND.NoticeID);
                        gnd ["Timestamp"]     = OSD.FromInteger((int)GND.Timestamp);
                        gnd ["FromName"]      = OSD.FromString(GND.FromName);
                        gnd ["Subject"]       = OSD.FromString(GND.Subject);
                        gnd ["HasAttachment"] = OSD.FromBoolean(GND.HasAttachment);
                        gnd ["ItemID"]        = OSD.FromUUID(GND.ItemID);
                        gnd ["AssetType"]     = OSD.FromInteger((int)GND.AssetType);
                        gnd ["ItemName"]      = OSD.FromString(GND.ItemName);

                        var notice = groups.GetGroupNotice(AdminAgentID, GND.NoticeID);
                        gnd ["Message"] = OSD.FromString(notice.Message);
                        groupNotices.Add(gnd);
                    }
                    resp ["GroupNotices"] = groupNotices;
                    resp ["Total"]        = (int)groups.GetNumberOfGroupNotices(AdminAgentID, GroupIDs);
                }
            }

            return(resp);
        }
Exemplo n.º 8
0
        void SaveUUIDList(uint EstateID, string table, UUID[] data)
        {
            OSDArray estate = new OSDArray();

            foreach (UUID uuid in data)
            {
                estate.Add(OSD.FromUUID(uuid));
            }

            string value = OSDParser.SerializeLLSDXmlString(estate);

            GD.Replace("estates", new string[] { "ID", "`Key`", "`Value`" }, new object[] { EstateID, table, value });
        }
Exemplo n.º 9
0
        private void UpdateAvatarPropertiesHandler(IClientAPI client, UserProfileData profileData)
        {
            OSDMap map = new OSDMap
            {
                { "About", OSD.FromString(profileData.AboutText) },
                { "Image", OSD.FromUUID(profileData.Image) },
                { "FLAbout", OSD.FromString(profileData.FirstLifeAboutText) },
                { "FLImage", OSD.FromUUID(profileData.FirstLifeImage) },
                { "URL", OSD.FromString(profileData.ProfileUrl) }
            };

            AddUserData(client.AgentId, "LLAbout", map);
        }
Exemplo n.º 10
0
        public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket)
        {
            OSDMap groupUpdate = new OSDMap {
                { "message", OSD.FromString("AgentGroupDataUpdate") }
            };

            OSDMap   body         = new OSDMap();
            OSDArray agentData    = new OSDArray();
            OSDMap   agentDataMap = new OSDMap {
                { "AgentID", OSD.FromUUID(groupUpdatePacket.AgentData.AgentID) }
            };

            agentData.Add(agentDataMap);
            body.Add("AgentData", agentData);

            OSDArray groupData = new OSDArray();

#if (!ISWIN)
            foreach (AgentGroupDataUpdatePacket.GroupDataBlock groupDataBlock in groupUpdatePacket.GroupData)
            {
                OSDMap groupDataMap = new OSDMap();
                groupDataMap.Add("ListInProfile", OSD.FromBoolean(false));
                groupDataMap.Add("GroupID", OSD.FromUUID(groupDataBlock.GroupID));
                groupDataMap.Add("GroupInsigniaID", OSD.FromUUID(groupDataBlock.GroupInsigniaID));
                groupDataMap.Add("Contribution", OSD.FromInteger(groupDataBlock.Contribution));
                groupDataMap.Add("GroupPowers", OSD.FromBinary(ulongToByteArray(groupDataBlock.GroupPowers)));
                groupDataMap.Add("GroupName", OSD.FromString(Utils.BytesToString(groupDataBlock.GroupName)));
                groupDataMap.Add("AcceptNotices", OSD.FromBoolean(groupDataBlock.AcceptNotices));

                groupData.Add(groupDataMap);
            }
#else
            foreach (OSDMap groupDataMap in groupUpdatePacket.GroupData.Select(groupDataBlock => new OSDMap
            {
                { "ListInProfile", OSD.FromBoolean(false) },
                { "GroupID", OSD.FromUUID(groupDataBlock.GroupID) },
                { "GroupInsigniaID", OSD.FromUUID(groupDataBlock.GroupInsigniaID) },
                { "Contribution", OSD.FromInteger(groupDataBlock.Contribution) },
                { "GroupPowers", OSD.FromBinary(ulongToByteArray(groupDataBlock.GroupPowers)) },
                { "GroupName", OSD.FromString(Utils.BytesToString(groupDataBlock.GroupName)) },
                { "AcceptNotices", OSD.FromBoolean(groupDataBlock.AcceptNotices) }
            }))
            {
                groupData.Add(groupDataMap);
            }
#endif
            body.Add("GroupData", groupData);
            groupUpdate.Add("body", body);

            return(groupUpdate);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Create an OSDMap from the appearance data
        /// </summary>
        public OSDMap Pack()
        {
            OSDMap data = new OSDMap();

            data["owner"]  = OSD.FromUUID(Owner);
            data["serial"] = OSD.FromInteger(m_serial);
            data["height"] = OSD.FromReal(m_avatarHeight);

            // Wearables
            List <AvatarWearable> wearables = GetWearables();
            OSDArray wears = new OSDArray(wearables.Count);

            foreach (AvatarWearable wearable in wearables)
            {
                wears.Add(wearable.Pack());
            }
            data["wearables"] = wears;

            // Avatar Textures
            OSDArray textures = new OSDArray(AvatarAppearance.TEXTURE_COUNT);

            for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
            {
                if (m_texture.FaceTextures[i] != null)
                {
                    textures.Add(OSD.FromUUID(m_texture.FaceTextures[i].TextureID));
                }
                else
                {
                    textures.Add(OSD.FromUUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE));
                }
            }
            data["textures"] = textures;

            // Visual Parameters
            OSDBinary visualparams = new OSDBinary(m_visualparams);

            data["visualparams"] = visualparams;

            // Attachments
            List <AvatarAttachment> attachments = GetAttachments();
            OSDArray attachs = new OSDArray(attachments.Count);

            foreach (AvatarAttachment attach in attachments)
            {
                attachs.Add(attach.Pack());
            }
            data["attachments"] = attachs;

            return(data);
        }
Exemplo n.º 12
0
        public OSD Pack()
        {
            OSDArray wearlist = new OSDArray();

            foreach (UUID id in m_ids)
            {
                OSDMap weardata = new OSDMap();
                weardata["item"]  = OSD.FromUUID(id);
                weardata["asset"] = OSD.FromUUID(m_items[id]);
                wearlist.Add(weardata);
            }

            return(wearlist);
        }
Exemplo n.º 13
0
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map["GroupID"]          = OSD.FromUUID(GroupID);
            map["IsGroupOwned"]     = OSD.FromBoolean(IsGroupOwned);
            map["OwnerID"]          = OSD.FromUUID(OwnerID);
            map["Maturity"]         = OSD.FromInteger(Maturity);
            map["Area"]             = OSD.FromInteger(Area);
            map["AuctionID"]        = OSD.FromUInteger(AuctionID);
            map["SalePrice"]        = OSD.FromInteger(SalePrice);
            map["InfoUUID"]         = OSD.FromUUID(InfoUUID);
            map["Dwell"]            = OSD.FromInteger(Dwell);
            map["Flags"]            = OSD.FromInteger((int)Flags);
            map["Name"]             = OSD.FromString(Name);
            map["Description"]      = OSD.FromString(Description);
            map["UserLocation"]     = OSD.FromVector3(UserLocation);
            map["LocalID"]          = OSD.FromInteger(LocalID);
            map["GlobalID"]         = OSD.FromUUID(GlobalID);
            map["RegionID"]         = OSD.FromUUID(RegionID);
            map["ScopeID"]          = OSD.FromUUID(ScopeID);
            map["MediaDescription"] = OSD.FromString(MediaDescription);
            map["MediaWidth"]       = OSD.FromInteger(MediaWidth);
            map["MediaHeight"]      = OSD.FromInteger(MediaHeight);
            map["MediaLoop"]        = OSD.FromBoolean(MediaLoop);
            map["MediaType"]        = OSD.FromString(MediaType);
            map["ObscureMedia"]     = OSD.FromBoolean(ObscureMedia);
            map["ObscureMusic"]     = OSD.FromBoolean(ObscureMusic);
            map["SnapshotID"]       = OSD.FromUUID(SnapshotID);
            map["MediaAutoScale"]   = OSD.FromInteger(MediaAutoScale);
            map["MediaLoopSet"]     = OSD.FromReal(MediaLoopSet);
            map["MediaURL"]         = OSD.FromString(MediaURL);
            map["MusicURL"]         = OSD.FromString(MusicURL);
            map["Bitmap"]           = OSD.FromBinary(Bitmap);
            map["Category"]         = OSD.FromInteger((int)Category);
            map["FirstParty"]       = OSD.FromBoolean(FirstParty);
            map["ClaimDate"]        = OSD.FromInteger(ClaimDate);
            map["ClaimPrice"]       = OSD.FromInteger(ClaimPrice);
            map["Status"]           = OSD.FromInteger((int)Status);
            map["LandingType"]      = OSD.FromInteger(LandingType);
            map["PassHours"]        = OSD.FromReal(PassHours);
            map["PassPrice"]        = OSD.FromInteger(PassPrice);
            map["UserLookAt"]       = OSD.FromVector3(UserLookAt);
            map["AuthBuyerID"]      = OSD.FromUUID(AuthBuyerID);
            map["OtherCleanTime"]   = OSD.FromInteger(OtherCleanTime);
            map["RegionHandle"]     = OSD.FromULong(RegionHandle);
            map["Private"]          = OSD.FromBoolean(Private);
            map["GenericDataMap"]   = GenericData;
            return(map);
        }
Exemplo n.º 14
0
        private void SendRegionOnline(SceneInfo neighbor)
        {
            // Build the region/online message
            uint regionX, regionY;

            GetRegionXY(m_scene.MinPosition, out regionX, out regionY);

            OSDMap regionOnline = new OSDMap
            {
                { "region_id", OSD.FromUUID(m_scene.ID) },
                { "region_name", OSD.FromString(m_scene.Name) },
                { "region_x", OSD.FromInteger(regionX) },
                { "region_y", OSD.FromInteger(regionY) }
            };

            // Put our public region seed capability into the message
            Uri publicSeedCap;

            if (m_scene.TryGetPublicCapability("public_region_seed_capability", out publicSeedCap))
            {
                regionOnline["public_region_seed_capability"] = OSD.FromUri(publicSeedCap);
            }
            else
            {
                m_log.Warn("Registering scene " + m_scene.Name + " with neighbor " + neighbor.Name + " without a public seed capability");
            }

            // Send the hello notification
            Uri regionOnlineCap;

            if (neighbor.TryGetCapability("region/online", out regionOnlineCap))
            {
                try
                {
                    UntrustedHttpWebRequest.PostToUntrustedUrl(regionOnlineCap, OSDParser.SerializeJsonString(regionOnline));
                    //m_log.Debug(scene.Name + " sent region/online to " + curScene.Name);
                }
                catch (Exception ex)
                {
                    m_log.Warn(m_scene.Name + " failed to send region/online to " + neighbor.Name + ": " +
                               ex.Message);
                }
            }
            else
            {
                m_log.Warn("No region/online capability found for " + neighbor.Name + ", " +
                           m_scene.Name + " is skipping it");
            }
        }
Exemplo n.º 15
0
        bool GetImageAssets(UUID avatarId)
        {
            string profileServerURI = string.Empty;
            string assetServerURI   = string.Empty;

            bool foreign = GetUserProfileServerURI(avatarId, out profileServerURI);

            if (!foreign)
            {
                return(true);
            }

            assetServerURI = UserManagementModule.GetUserServerURL(avatarId, "AssetServerURI");

            if (string.IsNullOrEmpty(profileServerURI) || string.IsNullOrEmpty(assetServerURI))
            {
                return(false);
            }

            OSDMap parameters = new OSDMap();

            parameters.Add("avatarId", OSD.FromUUID(avatarId));
            OSD Params = (OSD)parameters;

            if (!rpc.JsonRpcRequest(ref Params, "image_assets_request", profileServerURI, UUID.Random().ToString()))
            {
                return(false);
            }

            parameters = (OSDMap)Params;

            if (parameters.ContainsKey("result"))
            {
                OSDArray list = (OSDArray)parameters["result"];

                foreach (OSD asset in list)
                {
                    OSDString assetId = (OSDString)asset;

                    Scene.AssetService.Get(string.Format("{0}/{1}", assetServerURI, assetId.AsString()));
                }
                return(true);
            }
            else
            {
                m_log.ErrorFormat("[PROFILES]: Problematic response for image_assets_request from {0}", profileServerURI);
                return(false);
            }
        }
Exemplo n.º 16
0
        public byte[] HandleFetchInventory(Stream request, UUID AgentID)
        {
            try
            {
                //MainConsole.Instance.DebugFormat("[InventoryCAPS]: Received FetchInventory request for {0}", AgentID);

                OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(request);
                if (requestmap["items"].Type == OSDType.Unknown)
                {
                    return(MainServer.BadRequest);
                }
                OSDArray foldersrequested = (OSDArray)requestmap["items"];

                OSDMap map = new OSDMap {
                    { "agent_id", OSD.FromUUID(AgentID) }
                };
                //We have to send the agent_id in the main map as well as all the items

                OSDArray items = new OSDArray();
#if (!ISWIN)
                foreach (OSDMap requestedFolders in foldersrequested)
                {
                    UUID     itemId = requestedFolders["item_id"].AsUUID();
                    OSDArray item   = m_inventoryService.GetItem(itemId);
                    if (item != null && item.Count > 0)
                    {
                        items.Add(item[0]);
                    }
                }
#else
                foreach (OSDArray item in foldersrequested.Cast <OSDMap>().Select(requestedFolders => requestedFolders["item_id"].AsUUID()).Select(item_id => m_inventoryService.GetItem(item_id)).Where(item => item != null && item.Count > 0))
                {
                    items.Add(item[0]);
                }
#endif
                map.Add("items", items);

                byte[] response = OSDParser.SerializeLLSDXmlBytes(map);
                map.Clear();
                return(response);
            }
            catch (Exception ex)
            {
                MainConsole.Instance.Warn("[InventoryCaps]: SERIOUS ISSUE! " + ex);
            }
            OSDMap rmap = new OSDMap();
            rmap["items"] = new OSDArray();
            return(OSDParser.SerializeLLSDXmlBytes(rmap));
        }
Exemplo n.º 17
0
        /// <summary>
        ///   Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json
        /// </summary>
        /// <returns>map of the agent circuit data</returns>
        public virtual OSDMap PackAgentCircuitData()
        {
            OSDMap args = new OSDMap();

            args["agent_id"]          = OSD.FromUUID(AgentID);
            args["caps_path"]         = OSD.FromString(CapsPath);
            args["child"]             = OSD.FromBoolean(child);
            args["roothandle"]        = OSD.FromULong(roothandle);
            args["reallyischild"]     = OSD.FromBoolean(reallyischild);
            args["circuit_code"]      = OSD.FromString(circuitcode.ToString());
            args["secure_session_id"] = OSD.FromUUID(SecureSessionID);
            args["session_id"]        = OSD.FromUUID(SessionID);

            args["service_session_id"] = OSD.FromString(ServiceSessionID);
            args["start_pos"]          = OSD.FromString(startpos.ToString());
            args["client_ip"]          = OSD.FromString(IPAddress);
            args["otherInfo"]          = OSDParser.SerializeLLSDXmlString(OtherInformation);
            args["teleport_flags"]     = OSD.FromUInteger(teleportFlags);
            args["first_name"]         = OSD.FromString(firstname);
            args["last_name"]          = OSD.FromString(lastname);
            args["draw_distance"]      = DrawDistance;
            args["RegionUDPPort"]      = RegionUDPPort;

            if (Appearance != null)
            {
                args["appearance_serial"] = OSD.FromInteger(Appearance.Serial);

                OSDMap appmap = Appearance.Pack();
                args["packed_appearance"] = appmap;
            }
            else
            {
                MainConsole.Instance.Error("[AgentCircuitData]: NOT PACKING APPEARANCE FOR " + firstname + " " + lastname +
                                           ", user may be messed up");
            }

            if (ServiceURLs != null && ServiceURLs.Count > 0)
            {
                OSDMap urls = new OSDMap();
                foreach (KeyValuePair <string, object> kvp in ServiceURLs)
                {
                    //System.Console.WriteLine("XXX " + kvp.Key + "=" + kvp.Value);
                    urls[kvp.Key] = OSD.FromString((kvp.Value == null) ? string.Empty : kvp.Value.ToString());
                }
                args["serviceurls"] = urls;
            }

            return(args);
        }
Exemplo n.º 18
0
        public OSD HandleRemoteMapItemRequest(string path, OSD request, IPEndPoint endpoint)
        {
            uint xstart = 0;
            uint ystart = 0;

            Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);

            OSDMap responsemap     = new OSDMap();
            OSDMap responsemapdata = new OSDMap();
            int    tc = Environment.TickCount;

            List <ScenePresence> avatars     = m_scene.GetAvatars();
            OSDArray             responsearr = new OSDArray(avatars.Count);

            if (avatars.Count == 0)
            {
                responsemapdata           = new OSDMap();
                responsemapdata["X"]      = OSD.FromInteger((int)(xstart + 1));
                responsemapdata["Y"]      = OSD.FromInteger((int)(ystart + 1));
                responsemapdata["ID"]     = OSD.FromUUID(UUID.Zero);
                responsemapdata["Name"]   = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()));
                responsemapdata["Extra"]  = OSD.FromInteger(0);
                responsemapdata["Extra2"] = OSD.FromInteger(0);
                responsearr.Add(responsemapdata);

                responsemap["6"] = responsearr;
            }
            else
            {
                responsearr = new OSDArray(avatars.Count);
                foreach (ScenePresence av in avatars)
                {
                    Vector3 avpos;
                    if (av.HasSafePosition(out avpos))
                    {
                        responsemapdata           = new OSDMap();
                        responsemapdata["X"]      = OSD.FromInteger((int)(xstart + avpos.X));
                        responsemapdata["Y"]      = OSD.FromInteger((int)(ystart + avpos.Y));
                        responsemapdata["ID"]     = OSD.FromUUID(UUID.Zero);
                        responsemapdata["Name"]   = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()));
                        responsemapdata["Extra"]  = OSD.FromInteger(1);
                        responsemapdata["Extra2"] = OSD.FromInteger(0);
                        responsearr.Add(responsemapdata);
                    }
                }
                responsemap["6"] = responsearr;
            }
            return(responsemap);
        }
Exemplo n.º 19
0
            public OSD GetOSD()
            {
                OSDMap tex = new OSDMap(9);

                tex["first_life_text"]  = OSD.FromString(FirstLifeText);
                tex["first_life_image"] = OSD.FromUUID(FirstLifeImage);
                tex["partner"]          = OSD.FromUUID(Partner);
                tex["about_text"]       = OSD.FromString(AboutText);
                tex["born_on"]          = OSD.FromString(BornOn);
                tex["charter_member"]   = OSD.FromString(CharterMember);
                tex["profile_image"]    = OSD.FromUUID(ProfileImage);
                tex["flags"]            = OSD.FromInteger((byte)Flags);
                tex["profile_url"]      = OSD.FromString(ProfileURL);
                return(tex);
            }
Exemplo n.º 20
0
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map.Add("PrincipalID", OSD.FromUUID(PrincipalID));
            map.Add("Flags", OSD.FromInteger((int)Flags));
            map.Add("MaxMaturity", OSD.FromInteger(MaxMaturity));
            map.Add("MaturityRating", OSD.FromInteger(MaturityRating));
            map.Add("Language", OSD.FromString(Language));
            map.Add("AcceptTOS", OSD.FromBoolean(AcceptTOS));
            map.Add("LanguageIsPublic", OSD.FromBoolean(LanguageIsPublic));
            map.Add("OtherAgentInformation", OSD.FromString(OSDParser.SerializeLLSDXmlString(OtherAgentInformation)));

            return(map);
        }
Exemplo n.º 21
0
        /*		#region IService implementation
         *
         *      public void Initialize(IConfigSource config, IRegistryCore registry)
         *      {
         *          throw new System.NotImplementedException();
         *      }
         *
         *      public void Start(IConfigSource config, IRegistryCore registry)
         *      {
         *          throw new System.NotImplementedException();
         *      }
         *
         *      public void FinishedStartup()
         *      {
         *          throw new System.NotImplementedException();
         *      }
         *
         #endregion
         */

        #region user

        /// <summary>
        /// Gets user information for change user info page on site
        /// </summary>
        /// <param name="map">UUID</param>
        /// <returns>Verified, HomeName, HomeUUID, Online, Email, FirstName, LastName</returns>
        OSDMap GetGridUserInfo(OSDMap map)
        {
            string uuid = string.Empty;

            uuid = map ["UUID"].AsString();

            IUserAccountService accountService = m_registry.RequestModuleInterface <IUserAccountService> ();
            UserAccount         userAcct       = accountService.GetUserAccount(null, map ["UUID"].AsUUID());
            IAgentInfoService   agentService   = m_registry.RequestModuleInterface <IAgentInfoService> ();

            UserInfo userinfo;
            OSDMap   resp         = new OSDMap();
            bool     usr_verified = userAcct.Valid;

            resp ["Verified"]  = OSD.FromBoolean(usr_verified);
            resp ["UUID"]      = OSD.FromUUID(userAcct.PrincipalID);
            resp ["Email"]     = OSD.FromString(userAcct.Email);
            resp ["Name"]      = OSD.FromString(userAcct.Name);
            resp ["FirstName"] = OSD.FromString(userAcct.FirstName);
            resp ["LastName"]  = OSD.FromString(userAcct.LastName);

            // just some defaults
            resp ["HomeUUID"] = OSD.FromUUID(UUID.Zero);
            resp ["HomeName"] = OSD.FromString("");
            resp ["Online"]   = OSD.FromBoolean(false);


            if (verified)
            {
                userinfo = agentService.GetUserInfo(uuid);
                if (userinfo != null)
                {
                    resp ["HomeUUID"] = OSD.FromUUID(userinfo.HomeRegionID);
                    resp ["Online"]   = OSD.FromBoolean(userinfo.IsOnline);
                }
                IGridService gs = m_registry.RequestModuleInterface <IGridService> ();
                if (gs != null)
                {
                    GridRegion gr = gs.GetRegionByUUID(null, userinfo.HomeRegionID);
                    if (gr != null)
                    {
                        resp ["HomeName"] = OSD.FromString(gr.RegionName);
                    }
                }
            }

            return(resp);
        }
Exemplo n.º 22
0
        public void SerializeUUID()
        {
            OSD    llsdOne   = OSD.FromUUID(new UUID("97f4aeca-88a1-42a1-b385-b97b18abb255"));
            string sOne      = OSDParser.SerializeLLSDNotation(llsdOne);
            OSD    llsdOneDS = OSDParser.DeserializeLLSDNotation(sOne);

            Assert.AreEqual(OSDType.UUID, llsdOneDS.Type);
            Assert.AreEqual("97f4aeca-88a1-42a1-b385-b97b18abb255", llsdOneDS.AsString());

            OSD    llsdTwo   = OSD.FromUUID(new UUID("00000000-0000-0000-0000-000000000000"));
            string sTwo      = OSDParser.SerializeLLSDNotation(llsdTwo);
            OSD    llsdTwoDS = OSDParser.DeserializeLLSDNotation(sTwo);

            Assert.AreEqual(OSDType.UUID, llsdTwoDS.Type);
            Assert.AreEqual("00000000-0000-0000-0000-000000000000", llsdTwoDS.AsString());
        }
Exemplo n.º 23
0
        public string HandleFetchLib(string request, UUID AgentID)
        {
            try
            {
                //m_log.DebugFormat("[InventoryCAPS]: Received FetchLib request for {0}", AgentID);

                OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(OpenMetaverse.Utils.StringToBytes(request));

                OSDArray foldersrequested = (OSDArray)requestmap["items"];

                string response = "";
                OSDMap map      = new OSDMap();
                map.Add("agent_id", OSD.FromUUID(AgentID));
                OSDArray items = new OSDArray();
                for (int i = 0; i < foldersrequested.Count; i++)
                {
                    OSDMap            requestedFolders = (OSDMap)foldersrequested[i];
                    UUID              owner_id         = requestedFolders["owner_id"].AsUUID();
                    UUID              item_id          = requestedFolders["item_id"].AsUUID();
                    InventoryItemBase item             = null;
                    if (m_libraryService != null && m_libraryService.LibraryRootFolder != null)
                    {
                        item = m_libraryService.LibraryRootFolder.FindItem(item_id);
                    }
                    if (item == null) //Try normal inventory them
                    {
                        item = m_inventoryService.GetItem(new InventoryItemBase(item_id, owner_id));
                    }
                    if (item != null)
                    {
                        items.Add(ConvertInventoryItem(item, owner_id));
                    }
                }
                map.Add("items", items);

                response = OSDParser.SerializeLLSDXmlString(map);
                return(response);
            }
            catch (Exception ex)
            {
                m_log.Warn("[InventoryCaps]: SERIOUS ISSUE! " + ex.ToString());
            }
            OSDMap rmap = new OSDMap();

            rmap["folders"] = new OSDArray();
            return(OSDParser.SerializeLLSDXmlString(rmap));
        }
Exemplo n.º 24
0
        public static OSD PlacesQuery(PlacesReplyPacket PlacesReply, string[] regionType)
        {
            OSDMap placesReply = new OSDMap();

            placesReply.Add("message", OSD.FromString("PlacesReplyMessage"));

            OSDMap   body         = new OSDMap();
            OSDArray agentData    = new OSDArray();
            OSDMap   agentDataMap = new OSDMap();

            agentDataMap.Add("AgentID", OSD.FromUUID(PlacesReply.AgentData.AgentID));
            agentDataMap.Add("QueryID", OSD.FromUUID(PlacesReply.AgentData.QueryID));
            agentDataMap.Add("TransactionID", OSD.FromUUID(PlacesReply.TransactionData.TransactionID));
            agentData.Add(agentDataMap);
            body.Add("AgentData", agentData);

            OSDArray QueryData = new OSDArray();
            int      i         = 0;

            foreach (PlacesReplyPacket.QueryDataBlock groupDataBlock in PlacesReply.QueryData)
            {
                OSDMap QueryDataMap = new OSDMap();
                QueryDataMap.Add("ActualArea", OSD.FromInteger(groupDataBlock.ActualArea));
                QueryDataMap.Add("BillableArea", OSD.FromInteger(groupDataBlock.BillableArea));
                QueryDataMap.Add("Description", OSD.FromBinary(groupDataBlock.Desc));
                QueryDataMap.Add("Dwell", OSD.FromInteger((int)groupDataBlock.Dwell));
                QueryDataMap.Add("Flags", OSD.FromString(Convert.ToString(groupDataBlock.Flags)));
                QueryDataMap.Add("GlobalX", OSD.FromInteger((int)groupDataBlock.GlobalX));
                QueryDataMap.Add("GlobalY", OSD.FromInteger((int)groupDataBlock.GlobalY));
                QueryDataMap.Add("GlobalZ", OSD.FromInteger((int)groupDataBlock.GlobalZ));
                QueryDataMap.Add("Name", OSD.FromBinary(groupDataBlock.Name));
                QueryDataMap.Add("OwnerID", OSD.FromUUID(groupDataBlock.OwnerID));
                QueryDataMap.Add("SimName", OSD.FromBinary(groupDataBlock.SimName));
                QueryDataMap.Add("SnapShotID", OSD.FromUUID(groupDataBlock.SnapshotID));
                QueryDataMap.Add("ProductSku", OSD.FromString(regionType[i]));
                QueryDataMap.Add("Price", OSD.FromInteger(groupDataBlock.Price));

                QueryData.Add(QueryDataMap);
                i++;
            }
            body.Add("QueryData", QueryData);
            placesReply.Add("QueryData[]", body);

            placesReply.Add("body", body);

            return(placesReply);
        }
        /// <summary>
        /// Delete a Pick
        /// </summary>
        /// <param name='remoteClient'>
        /// Remote client.
        /// </param>
        /// <param name='queryPickID'>
        /// Query pick I.
        /// </param>
        public void PickDelete(IClientAPI remoteClient, UUID queryPickID)
        {
            string serverURI = string.Empty;

            GetUserProfileServerURI(remoteClient.AgentId, out serverURI);

            OSDMap parameters = new OSDMap();

            parameters.Add("pickId", OSD.FromUUID(queryPickID));
            OSD Params = (OSD)parameters;

            if (!rpc.JsonRpcRequest(ref Params, "picks_delete", serverURI, UUID.Random().ToString()))
            {
                remoteClient.SendAgentAlertMessage(
                    "Error picks delete", false);
            }
        }
Exemplo n.º 26
0
        private void SaveBanList(EstateSettings es)
        {
            OSDMap estateBans = new OSDMap();

            foreach (EstateBan b in es.EstateBans)
            {
                OSDMap estateBan = new OSDMap();
                estateBan.Add("BannedUserID", OSD.FromUUID(b.BannedUserID));
                estateBan.Add("BannedHostAddress", OSD.FromString(b.BannedHostAddress));
                estateBan.Add("BannedHostIPMask", OSD.FromString(b.BannedHostIPMask));
                estateBans.Add(b.BannedUserID.ToString(), estateBan);
            }

            string value = OSDParser.SerializeLLSDXmlString(estateBans);

            GD.Replace("estates", new string[] { "ID", "`Key`", "`Value`" }, new object[] { es.EstateID, "EstateBans", value });
        }
Exemplo n.º 27
0
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map.Add("RegionID", OSD.FromUUID(RegionID));
            map.Add("RegionLocX", OSD.FromReal(RegionLocX));
            map.Add("RegionLocY", OSD.FromReal(RegionLocY));
            map.Add("TelehubRotX", OSD.FromReal(TelehubRotX));
            map.Add("TelehubRotY", OSD.FromReal(TelehubRotY));
            map.Add("TelehubRotZ", OSD.FromReal(TelehubRotZ));
            map.Add("TelehubLocX", OSD.FromReal(TelehubLocX));
            map.Add("TelehubLocY", OSD.FromReal(TelehubLocY));
            map.Add("TelehubLocZ", OSD.FromReal(TelehubLocZ));
            map.Add("Spawns", OSD.FromString(BuildFromList(SpawnPos)));
            map.Add("ObjectUUID", OSD.FromUUID(ObjectUUID));
            map.Add("Name", OSD.FromString(Name));
            return(map);
        }
Exemplo n.º 28
0
        OSDMap Login(OSDMap map, bool asAdmin)
        {
            bool   Verified = false;
            string Name     = map ["Name"].AsString();
            string Password = map ["Password"].AsString();

            var         loginService   = m_registry.RequestModuleInterface <ILoginService> ();
            var         accountService = m_registry.RequestModuleInterface <IUserAccountService> ();
            UserAccount account        = null;
            var         resp           = new OSDMap();

            resp ["Verified"] = OSD.FromBoolean(false);

            if (accountService == null || CheckIfUserExists(map) ["Verified"] != true)
            {
                return(resp);
            }

            account = accountService.GetUserAccount(null, Name);
            if (account == null)
            {
                return(resp);            // something nasty here
            }
            if (loginService.VerifyClient(account.PrincipalID, Name, "UserAccount", Password))
            {
                if (asAdmin)
                {
                    IAgentInfo agent = DataPlugins.RequestPlugin <IAgentConnector> ().GetAgent(account.PrincipalID);
                    if (agent.OtherAgentInformation ["WebUIEnabled"].AsBoolean() == false)
                    {
                        return(resp);
                    }
                }
                resp ["UUID"]      = OSD.FromUUID(account.PrincipalID);
                resp ["FirstName"] = OSD.FromString(account.FirstName);
                resp ["LastName"]  = OSD.FromString(account.LastName);
                resp ["Email"]     = OSD.FromString(account.Email);
                Verified           = true;
            }

            resp ["Verified"] = OSD.FromBoolean(Verified);

            return(resp);
        }
Exemplo n.º 29
0
        public OSDMap PackRegionInfoData(bool secure)
        {
            OSDMap args = new OSDMap();

            args["region_id"] = OSD.FromUUID(RegionID);
            if ((RegionName != null) && !RegionName.Equals(""))
            {
                args["region_name"] = OSD.FromString(RegionName);
            }
            args["region_xloc"]         = OSD.FromString(RegionLocX.ToString());
            args["region_yloc"]         = OSD.FromString(RegionLocY.ToString());
            args["internal_ep_address"] = OSD.FromString(InternalEndPoint.Address.ToString());
            args["internal_ep_port"]    = OSD.FromString(InternalEndPoint.Port.ToString());
            if (RegionType != String.Empty)
            {
                args["region_type"] = OSD.FromString(RegionType);
            }
            args["password"]      = OSD.FromUUID(Password);
            args["region_size_x"] = OSD.FromInteger(RegionSizeX);
            args["region_size_y"] = OSD.FromInteger(RegionSizeY);
            args["region_size_z"] = OSD.FromInteger(RegionSizeZ);
#if (!ISWIN)
            OSDArray ports = new OSDArray(UDPPorts.ConvertAll <OSD>(delegate(int a) { return(a); }));
#else
            OSDArray ports = new OSDArray(UDPPorts.ConvertAll <OSD>(a => a));
#endif
            args["UDPPorts"]       = ports;
            args["InfiniteRegion"] = OSD.FromBoolean(InfiniteRegion);
            if (secure)
            {
                args["disabled"]        = OSD.FromBoolean(Disabled);
                args["scope_id"]        = OSD.FromUUID(ScopeID);
                args["object_capacity"] = OSD.FromInteger(m_objectCapacity);
                args["region_type"]     = OSD.FromString(RegionType);
                args["see_into_this_sim_from_neighbor"]  = OSD.FromBoolean(SeeIntoThisSimFromNeighbor);
                args["trust_binaries_from_foreign_sims"] = OSD.FromBoolean(TrustBinariesFromForeignSims);
                args["allow_script_crossing"]            = OSD.FromBoolean(AllowScriptCrossing);
                args["allow_physical_prims"]             = OSD.FromBoolean(AllowPhysicalPrims);
                args["number_startup"] = OSD.FromInteger(NumberStartup);
                args["startupType"]    = OSD.FromInteger((int)Startup);
                args["RegionSettings"] = RegionSettings.ToOSD();
            }
            return(args);
        }
Exemplo n.º 30
0
        void SendGroupMembershipInfoViaCaps(IClientAPI remoteClient, GroupMembershipData[] data)
        {
            m_log.InfoFormat("[Groups] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            OSDArray AgentData    = new OSDArray(1);
            OSDMap   AgentDataMap = new OSDMap(1);

            AgentDataMap.Add("AgentID", OSD.FromUUID(remoteClient.AgentId));
            AgentData.Add(AgentDataMap);


            OSDArray GroupData    = new OSDArray(data.Length);
            OSDArray NewGroupData = new OSDArray(data.Length);

            foreach (GroupMembershipData membership in data)
            {
                OSDMap GroupDataMap    = new OSDMap(6);
                OSDMap NewGroupDataMap = new OSDMap(1);

                GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID));
                GroupDataMap.Add("GroupPowers", OSD.FromBinary(membership.GroupPowers));
                GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices));
                GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture));
                GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution));
                GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName));
                NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile));

                GroupData.Add(GroupDataMap);
                NewGroupData.Add(NewGroupDataMap);
            }

            OSDMap llDataStruct = new OSDMap(3);

            llDataStruct.Add("AgentData", AgentData);
            llDataStruct.Add("GroupData", GroupData);
            llDataStruct.Add("NewGroupData", NewGroupData);

            IEventQueue queue = remoteClient.Scene.RequestModuleInterface <IEventQueue>();

            if (queue != null)
            {
                queue.Enqueue(EventQueueHelper.buildEvent("AgentGroupDataUpdate", llDataStruct), remoteClient.AgentId);
            }
        }