Exemplo n.º 1
0
        public List <LandData> GetParcelsByRegion(uint start, uint count, UUID RegionID, UUID scopeID, UUID owner, ParcelFlags flags, ParcelCategory category)
        {
            List <LandData> resp = new List <LandData>(0);

            if (count == 0)
            {
                return(resp);
            }
            OSDMap mess = new OSDMap();

            mess["Method"]   = "GetParcelsByRegion";
            mess["start"]    = OSD.FromUInteger(start);
            mess["count"]    = OSD.FromUInteger(count);
            mess["RegionID"] = OSD.FromUUID(RegionID);
            mess["scopeID"]  = OSD.FromUUID(scopeID);
            mess["owner"]    = OSD.FromUUID(owner);
            mess["flags"]    = OSD.FromUInteger((uint)flags);
            mess["category"] = OSD.FromInteger((int)category);
            List <string> m_ServerURIs =
                m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI");

            resp = new List <LandData>();
            foreach (string m_ServerURI in m_ServerURIs)
            {
                OSDMap   results      = WebUtils.PostToService(m_ServerURI + "osd", mess, true, false);
                OSDMap   innerResults = (OSDMap)OSDParser.DeserializeJson(results["_RawResult"]);
                OSDArray parcels      = (OSDArray)innerResults["Parcels"];
                foreach (OSD o in parcels)
                {
                    resp.Add(new LandData((OSDMap)o));
                }
                break;
            }
            return(resp);
        }
Exemplo n.º 2
0
            public OSD GetOSD(int faceNumber)
            {
                OSDMap tex = new OSDMap(10);

                if (faceNumber >= 0)
                {
                    tex["face_number"] = OSD.FromInteger(faceNumber);
                }
                tex["colors"]      = OSD.FromColor4(RGBA);
                tex["scales"]      = OSD.FromReal(RepeatU);
                tex["scalet"]      = OSD.FromReal(RepeatV);
                tex["offsets"]     = OSD.FromReal(OffsetU);
                tex["offsett"]     = OSD.FromReal(OffsetV);
                tex["imagerot"]    = OSD.FromReal(Rotation);
                tex["bump"]        = OSD.FromInteger((int)Bump);
                tex["shiny"]       = OSD.FromInteger((int)Shiny);
                tex["fullbright"]  = OSD.FromBoolean(Fullbright);
                tex["media_flags"] = OSD.FromInteger(Convert.ToInt32(MediaFlags));
                tex["mapping"]     = OSD.FromInteger((int)TexMapType);
                tex["glow"]        = OSD.FromReal(Glow);

                if (TextureID != Primitive.TextureEntry.WHITE_TEXTURE)
                {
                    tex["imageid"] = OSD.FromUUID(TextureID);
                }
                else
                {
                    tex["imageid"] = OSD.FromUUID(UUID.Zero);
                }

                return(tex);
            }
Exemplo n.º 3
0
        public bool CheckName(string firstName, LastName lastName)
        {
            if (Initializing)
            {
                throw new InvalidOperationException("still initializing");
            }

            if (_caps.CheckName == null)
            {
                throw new InvalidOperationException("access denied; only approved developers have access to the registration api");
            }

            // Create the POST data
            OSDMap query = new OSDMap();

            query.Add("username", OSD.FromString(firstName));
            query.Add("last_name_id", OSD.FromInteger(lastName.ID));
            //byte[] postData = OSDParser.SerializeXmlBytes(query);

            CapsClient request = new CapsClient(_caps.CheckName);

            request.OnComplete += new CapsClient.CompleteCallback(CheckNameResponse);
            request.BeginGetResponse(REQUEST_TIMEOUT);

            // FIXME:
            return(false);
        }
Exemplo n.º 4
0
        OSDMap GetAbuseReports(OSDMap map)
        {
            var resp     = new OSDMap();
            var areports = m_registry.RequestModuleInterface <IAbuseReports> ();

            int  start  = map ["Start"].AsInteger();
            int  count  = map ["Count"].AsInteger();
            bool active = map ["Active"].AsBoolean();

            List <AbuseReport> arList = areports.GetAbuseReports(start, count, active);
            var AbuseReports          = new OSDArray();

            if (arList != null)
            {
                foreach (AbuseReport rpt in arList)
                {
                    AbuseReports.Add(rpt.ToOSD());
                }
            }

            resp ["AbuseReports"] = AbuseReports;
            resp ["Start"]        = OSD.FromInteger(start);
            resp ["Count"]        = OSD.FromInteger(count);
            resp ["Active"]       = OSD.FromBoolean(active);

            return(resp);
        }
        /// <summary>
        /// Serialize to OSD
        /// </summary>
        /// <returns>OSDMap with the serialized data</returns>
        public OSDMap GetOSD()
        {
            OSDMap map = new OSDMap();

            map["alt_image_enable"]     = OSD.FromBoolean(EnableAlterntiveImage);
            map["auto_loop"]            = OSD.FromBoolean(AutoLoop);
            map["auto_play"]            = OSD.FromBoolean(AutoPlay);
            map["auto_scale"]           = OSD.FromBoolean(AutoScale);
            map["auto_zoom"]            = OSD.FromBoolean(AutoZoom);
            map["controls"]             = OSD.FromInteger((int)Controls);
            map["current_url"]          = OSD.FromString(CurrentURL);
            map["first_click_interact"] = OSD.FromBoolean(InteractOnFirstClick);
            map["height_pixels"]        = OSD.FromInteger(Height);
            map["home_url"]             = OSD.FromString(HomeURL);
            map["perms_control"]        = OSD.FromInteger((int)ControlPermissions);
            map["perms_interact"]       = OSD.FromInteger((int)InteractPermissions);

            List <OSD> wl = new List <OSD>();

            if (WhiteList != null && WhiteList.Length > 0)
            {
                for (int i = 0; i < WhiteList.Length; i++)
                {
                    wl.Add(OSD.FromString(WhiteList[i]));
                }
            }

            map["whitelist"]        = new OSDArray(wl);
            map["whitelist_enable"] = OSD.FromBoolean(EnableWhiteList);
            map["width_pixels"]     = OSD.FromInteger(Width);

            return(map);
        }
Exemplo n.º 6
0
        public static OSD TeleportFinishEvent(
            ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
            uint locationID, uint flags, string capsURL, UUID agentID,
            int regionSizeX, int regionSizeY)
        {
            OSDMap info = new OSDMap();

            info.Add("AgentID", OSD.FromUUID(agentID));
            info.Add("LocationID", OSD.FromInteger(4)); // TODO what is this?
            info.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(regionHandle)));
            info.Add("SeedCapability", OSD.FromString(capsURL));
            info.Add("SimAccess", OSD.FromInteger(simAccess));
            info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes()));
            info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port));
            info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
            info.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
            info.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));

            OSDArray infoArr = new OSDArray();

            infoArr.Add(info);

            OSDMap body = new OSDMap();

            body.Add("Info", infoArr);

            return(BuildEvent("TeleportFinish", body));
        }
Exemplo n.º 7
0
        public static OSD TeleportFinishEvent(
            ulong regionHandle, byte simAccess, IPAddress address, int port,
            uint locationID, string capsURL, UUID agentID, uint teleportFlags, int RegionSizeX, int RegionSizeY)
        {
            OSDMap info = new OSDMap {
                { "AgentID", OSD.FromUUID(agentID) },
                { "LocationID", OSD.FromBinary(uintToByteArray(locationID)) },
                { "RegionHandle", OSD.FromBinary(ulongToByteArray(regionHandle)) },
                { "SeedCapability", OSD.FromString(capsURL) },
                { "SimAccess", OSD.FromInteger(simAccess) },
                { "SimIP", OSD.FromBinary(address.GetAddressBytes()) },
                { "SimPort", OSD.FromInteger(port) },
                { "TeleportFlags", OSD.FromBinary(uintToByteArray(teleportFlags)) },
                { "RegionSizeX", OSD.FromUInteger((uint)RegionSizeX) },
                { "RegionSizeY", OSD.FromUInteger((uint)RegionSizeY) }
            };

            OSDArray infoArr = new OSDArray {
                info
            };

            OSDMap body = new OSDMap {
                { "Info", infoArr }
            };

            return(buildEvent("TeleportFinish", body));
        }
Exemplo n.º 8
0
        private UserSession AnonymousLogin(string name, byte accessLevel, OSDMap extraData, string identifier, string type, string credential)
        {
            User user;

            if (!m_userClient.TryAuthorizeIdentity(identifier, type, credential, out user))
            {
                // We don't have an e-mail address for this person so just create a random string for the e-mail
                string email = "INVALID " + UUID.Random().ToString();

                // Create a new user and identity
                m_userClient.CreateUser(name, email, accessLevel, extraData, out user);
                m_userClient.CreateIdentity(new Identity {
                    UserID = user.ID, Enabled = true, Credential = credential, Identifier = identifier, Type = type
                });
            }

            // Create a session for this user
            UserSession session = new UserSession(user);

            session.SessionID       = UUID.Random();
            session.SecureSessionID = UUID.Random();
            session.SetField("CircuitCode", OSD.FromInteger(m_circuitCodeGenerator.Next()));
            user.LastLogin = DateTime.UtcNow;

            // Store the session in the user service
            m_userClient.AddSession(session);

            return(session);
        }
        public override OSDMap ToOSD()
        {
            OSDMap Classified = new OSDMap {
                { "ClassifiedUUID", OSD.FromUUID(ClassifiedUUID) },
                { "CreatorUUID", OSD.FromUUID(CreatorUUID) },
                { "CreationDate", OSD.FromUInteger(CreationDate) },
                { "ExpirationDate", OSD.FromUInteger(ExpirationDate) },
                { "Category", OSD.FromUInteger(Category) },
                { "Name", OSD.FromString(Name) },
                { "Description", OSD.FromString(Description) },
                { "ParcelUUID", OSD.FromUUID(ParcelUUID) },
                { "ParentEstate", OSD.FromUInteger(ParentEstate) },
                { "SnapshotUUID", OSD.FromUUID(SnapshotUUID) },
                { "ScopeID", OSD.FromUUID(ScopeID) },
                { "SimName", OSD.FromString(SimName) },
                //  broken for non en_US locales                                        {"GlobalPos", OSD.FromVector3(GlobalPos)},
                { "GPosX", OSD.FromReal(GlobalPos.X).ToString() },
                { "GPosY", OSD.FromReal(GlobalPos.Y).ToString() },
                { "GPosZ", OSD.FromReal(GlobalPos.Z).ToString() },
                { "ParcelName", OSD.FromString(ParcelName) },
                { "ClassifiedFlags", OSD.FromInteger(ClassifiedFlags) },
                { "PriceForListing", OSD.FromInteger(PriceForListing) }
            };

            return(Classified);
        }
Exemplo n.º 10
0
 public OSDMap PackRegionInfoData()
 {
     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());
     if (RegionType != String.Empty)
         args["region_type"] = OSD.FromString(RegionType);
     args["region_size_x"] = OSD.FromInteger(RegionSizeX);
     args["region_size_y"] = OSD.FromInteger(RegionSizeY);
     args["region_size_z"] = OSD.FromInteger(RegionSizeZ);
     args["InfiniteRegion"] = OSD.FromBoolean(InfiniteRegion);
     args["scope_id"] = OSD.FromUUID(ScopeID);
     args["all_scope_ids"] = AllScopeIDs.ToOSDArray();
     args["object_capacity"] = OSD.FromInteger(m_objectCapacity);
     args["region_type"] = OSD.FromString(RegionType);
     args["see_into_this_sim_from_neighbor"] = OSD.FromBoolean(SeeIntoThisSimFromNeighbor);
     args["startupType"] = OSD.FromInteger((int) Startup);
     args["RegionSettings"] = RegionSettings.ToOSD();
     args["GridSecureSessionID"] = GridSecureSessionID;
     if (EnvironmentSettings != null)
         args["EnvironmentSettings"] = EnvironmentSettings;
     args["OpenRegionSettings"] = OpenRegionSettings.ToOSD();
     return args;
 }
Exemplo n.º 11
0
        private static UUID CreateItem(Dictionary <UUID, InventoryBase> inventory, UUID parentID, string name, string description,
                                       WearableType wearableType, UUID assetID, string assetType, UUID agentID)
        {
            InventoryItem item = new InventoryItem();

            item.ID           = UUID.Random();
            item.Name         = name;
            item.Description  = description;
            item.OwnerID      = agentID;
            item.ParentID     = parentID;
            item.AssetID      = assetID;
            item.ContentType  = assetType;
            item.CreationDate = DateTime.UtcNow;

            // HACK: Set LLInventoryItem flags
            item.ExtraData["flags"] = OSD.FromInteger((int)wearableType);

            // HACK: Set default LLInventoryItem permissions
            Permissions perm = Permissions.NoPermissions;

            perm.BaseMask                 = PermissionMask.All;
            perm.OwnerMask                = PermissionMask.All;
            perm.NextOwnerMask            = PermissionMask.All;
            item.ExtraData["permissions"] = perm.GetOSD();

            InventoryBase parent;

            if (inventory.TryGetValue(parentID, out parent) && parent is InventoryFolder)
            {
                ((InventoryFolder)parent).Children[item.ID] = item;
            }

            inventory[item.ID] = item;
            return(item.ID);
        }
Exemplo n.º 12
0
        OSDMap ForgotPassword(OSDMap map)
        {
            UUID   UUDI     = map ["UUID"].AsUUID();
            string Password = map ["Password"].AsString();

            IUserAccountService accountService = m_registry.RequestModuleInterface <IUserAccountService> ();
            UserAccount         user           = accountService.GetUserAccount(null, UUDI);

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

            resp ["Verified"]  = OSD.FromBoolean(verified);
            resp ["UserLevel"] = OSD.FromInteger(0);
            if (verified)
            {
                resp ["UserLevel"] = OSD.FromInteger(user.UserLevel);
                if (user.UserLevel >= 0)
                {
                    IAuthenticationService auths = m_registry.RequestModuleInterface <IAuthenticationService> ();
                    auths.SetPassword(user.PrincipalID, "UserAccount", Password);
                }
                else
                {
                    resp ["Verified"] = OSD.FromBoolean(false);
                }
            }

            return(resp);
        }
Exemplo n.º 13
0
        OSDMap FindUsers(OSDMap map)
        {
            OSDMap             resp     = new OSDMap();
            int                start    = map ["Start"].AsInteger();
            int                end      = map ["End"].AsInteger();
            string             Query    = map ["Query"].AsString();
            List <UserAccount> accounts = m_registry.RequestModuleInterface <IUserAccountService> ().GetUserAccounts(null, Query);

            OSDArray users = new OSDArray();

            MainConsole.Instance.TraceFormat("{0} accounts found", accounts.Count);
            for (int i = start; i < end && i < accounts.Count; i++)
            {
                UserAccount acc      = accounts [i];
                OSDMap      userInfo = new OSDMap();
                userInfo ["PrincipalID"] = acc.PrincipalID;
                userInfo ["UserName"]    = acc.Name;
                userInfo ["Created"]     = acc.Created;
                userInfo ["UserFlags"]   = acc.UserFlags;
                users.Add(userInfo);
            }
            resp ["Users"] = users;

            resp ["Start"] = OSD.FromInteger(start);
            resp ["End"]   = OSD.FromInteger(end);
            resp ["Query"] = OSD.FromString(Query);

            return(resp);
        }
Exemplo n.º 14
0
        byte[] ForgotPassword(OSDMap map)
        {
            UUID   UUDI     = map["UUID"].AsUUID();
            string Password = map["Password"].AsString();

            IUserAccountService accountService = m_registry.RequestModuleInterface <IUserAccountService>();
            UserAccount         user           = accountService.GetUserAccount(UUID.Zero, UUDI);

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

            resp["Verified"]  = OSD.FromBoolean(verified);
            resp["UserLevel"] = OSD.FromInteger(0);
            if (verified)
            {
                resp["UserLevel"] = OSD.FromInteger(user.UserLevel);
                if (user.UserLevel >= 0)
                {
                    IAuthenticationService auths = m_registry.RequestModuleInterface <IAuthenticationService>();
                    auths.SetPassword(user.PrincipalID, "UserAccount", Password);
                }
                else
                {
                    resp["Verified"] = OSD.FromBoolean(false);
                }
            }

            string       xmlString = OSDParser.SerializeJsonString(resp);
            UTF8Encoding encoding  = new UTF8Encoding();

            return(encoding.GetBytes(xmlString));
        }
Exemplo n.º 15
0
        public OSD GetOSD()
        {
            OSDMap material_data = new OSDMap(17);

            material_data [MATERIALS_CAP_NORMAL_MAP_FIELD] = OSD.FromUUID(NormalID);

            material_data [MATERIALS_CAP_NORMAL_MAP_OFFSET_X_FIELD] = OSD.FromInteger(llRound(NormalOffsetX * MATERIALS_MULTIPLIER));
            material_data [MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD] = OSD.FromInteger(llRound(NormalOffsetY * MATERIALS_MULTIPLIER));
            material_data [MATERIALS_CAP_NORMAL_MAP_REPEAT_X_FIELD] = OSD.FromInteger(llRound(NormalRepeatX * MATERIALS_MULTIPLIER));
            material_data [MATERIALS_CAP_NORMAL_MAP_REPEAT_Y_FIELD] = OSD.FromInteger(llRound(NormalRepeatY * MATERIALS_MULTIPLIER));
            material_data [MATERIALS_CAP_NORMAL_MAP_ROTATION_FIELD] = OSD.FromInteger(llRound(NormalRotation * MATERIALS_MULTIPLIER));

            material_data [MATERIALS_CAP_SPECULAR_MAP_FIELD]          = OSD.FromUUID(SpecularID);
            material_data [MATERIALS_CAP_SPECULAR_MAP_OFFSET_X_FIELD] = OSD.FromInteger(llRound(SpecularOffsetX * MATERIALS_MULTIPLIER));
            material_data [MATERIALS_CAP_SPECULAR_MAP_OFFSET_Y_FIELD] = OSD.FromInteger(llRound(SpecularOffsetY * MATERIALS_MULTIPLIER));
            material_data [MATERIALS_CAP_SPECULAR_MAP_REPEAT_X_FIELD] = OSD.FromInteger(llRound(SpecularRepeatX * MATERIALS_MULTIPLIER));
            material_data [MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD] = OSD.FromInteger(llRound(SpecularRepeatY * MATERIALS_MULTIPLIER));
            material_data [MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD] = OSD.FromInteger(llRound(SpecularRotation * MATERIALS_MULTIPLIER));

            OSDArray specularColor = new OSDArray();

            specularColor.Add(OSD.FromInteger(SpecularLightColorR));
            specularColor.Add(OSD.FromInteger(SpecularLightColorG));
            specularColor.Add(OSD.FromInteger(SpecularLightColorB));
            specularColor.Add(OSD.FromInteger(SpecularLightColorA));

            material_data[MATERIALS_CAP_SPECULAR_COLOR_FIELD]      = specularColor;
            material_data [MATERIALS_CAP_SPECULAR_EXP_FIELD]       = OSD.FromInteger((int)SpecularLightExponent);
            material_data [MATERIALS_CAP_ENV_INTENSITY_FIELD]      = OSD.FromInteger((int)EnvironmentIntensity);
            material_data [MATERIALS_CAP_DIFFUSE_ALPHA_MODE_FIELD] = OSD.FromInteger((int)DiffuseAlphaMode);
            material_data [MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD]  = OSD.FromInteger((int)AlphaMaskCutoff);

            return(material_data);
        }
Exemplo n.º 16
0
        internal static OSD ChatterBoxSessionStartReply(UUID sessionID, string SessionName)
        {
            OSDMap body        = new OSDMap();
            OSDMap sessionInfo = new OSDMap();
            //OSDMap infoDetail = new OSDMap();
            OSDMap moderatedMode = new OSDMap {
                { "voice", OSD.FromBoolean(true) }
            };

            sessionInfo.Add("moderated_mode", sessionInfo);
            sessionInfo.Add("session_name", OSD.FromString(SessionName));
            sessionInfo.Add("type", OSD.FromInteger(0));
            sessionInfo.Add("voice_enabled", OSD.FromBoolean(true));

            body.Add("session_info", sessionInfo);
            body.Add("temp_session_id", OSD.FromUUID(sessionID));
            body.Add("success", OSD.FromBoolean(true));

            OSDMap chatterBoxSessionAgentListUpdates = new OSDMap
            {
                { "message", OSD.FromString("ChatterBoxSessionStartReply") },
                { "body", body }
            };

            return(chatterBoxSessionAgentListUpdates);
        }
Exemplo n.º 17
0
        public override OSD GetOSD()
        {
            OSDMap Avi = (OSDMap)base.GetOSD();

            OSDArray grp = new OSDArray();

            Groups.ForEach(delegate(UUID u) { grp.Add(OSD.FromUUID(u)); });

            OSDArray vp = new OSDArray();

            for (int i = 0; i < VisualParameters.Length; i++)
            {
                vp.Add(OSD.FromInteger(VisualParameters[i]));
            }

            Avi["groups"]             = grp;
            Avi["profile_statistics"] = ProfileStatistics.GetOSD();
            Avi["profile_properties"] = ProfileProperties.GetOSD();
            Avi["profile_interest"]   = ProfileInterests.GetOSD();
            Avi["control_flags"]      = OSD.FromInteger((byte)ControlFlags);
            Avi["visual_parameters"]  = vp;
            Avi["first_name"]         = OSD.FromString(FirstName);
            Avi["last_name"]          = OSD.FromString(LastName);
            Avi["group_name"]         = OSD.FromString(GroupName);

            return(Avi);
        }
Exemplo n.º 18
0
        private void AvatarInterestsUpdateHandler(Packet packet, LLAgent agent)
        {
            AvatarInterestsUpdatePacket update = (AvatarInterestsUpdatePacket)packet;

            User user;

            if (m_userClient != null && m_userClient.TryGetUser(agent.ID, out user))
            {
                OSDMap map = new OSDMap
                {
                    { "WantMask", OSD.FromInteger((int)update.PropertiesData.WantToMask) },
                    { "WantText", OSD.FromString(Utils.BytesToString(update.PropertiesData.WantToText)) },
                    { "SkillsMask", OSD.FromInteger((int)update.PropertiesData.SkillsMask) },
                    { "SkillsText", OSD.FromString(Utils.BytesToString(update.PropertiesData.SkillsText)) },
                    { "Languages", OSD.FromString(Utils.BytesToString(update.PropertiesData.LanguagesText)) }
                };

                m_userClient.UpdateUserFields(agent.ID, new OSDMap {
                    { "LLInterests", map }
                });
            }
            else
            {
                m_log.Warn("Could not find user " + agent.ID + ", not updating profile interests for " + agent.Name);
                SendAvatarInterests(agent, agent.ID, null);
            }
        }
Exemplo n.º 19
0
        public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket)
        {
            OSDMap groupUpdate = new OSDMap();

            groupUpdate.Add("message", OSD.FromString("AgentGroupDataUpdate"));

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

            agentDataMap.Add("AgentID", OSD.FromUUID(groupUpdatePacket.AgentData.AgentID));
            agentData.Add(agentDataMap);
            body.Add("AgentData", agentData);

            OSDArray groupData = new OSDArray();

            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);
            }
            body.Add("GroupData", groupData);
            groupUpdate.Add("body", body);

            return(groupUpdate);
        }
Exemplo n.º 20
0
        /// <summary>
        ///     Send back a user's display name
        /// </summary>
        /// <param name="newDisplayName"></param>
        /// <param name="oldDisplayName"></param>
        /// <param name="iD"></param>
        /// <param name="isDefault"></param>
        /// <param name="first"></param>
        /// <param name="last"></param>
        /// <param name="account"></param>
        /// <returns></returns>
        OSD DisplayNameReply(string newDisplayName, string oldDisplayName, UUID iD, bool isDefault, string first,
                             string last, string account, DateTime nextUpdate)
        {
            OSDMap nameReply = new OSDMap();

            OSDMap body      = new OSDMap();
            OSDMap content   = new OSDMap();
            OSDMap agentData = new OSDMap();

            content.Add("display_name", OSD.FromString(newDisplayName));
            content.Add("display_name_next_update", OSD.FromDate(nextUpdate));
            content.Add("id", OSD.FromUUID(iD));
            content.Add("is_display_name_default", OSD.FromBoolean(isDefault));
            content.Add("legacy_first_name", OSD.FromString(first));
            content.Add("legacy_last_name", OSD.FromString(last));
            content.Add("username", OSD.FromString(account));

            body.Add("content", content);
            body.Add("agent", agentData);
            //body.Add ("old_display_name", OSD.FromString (oldDisplayName));
            body.Add("reason", OSD.FromString("OK"));
            body.Add("status", OSD.FromInteger(200));

            nameReply.Add("body", body);
            nameReply.Add("message", OSD.FromString("SetDisplayNameReply"));

            return(nameReply);
        }
Exemplo n.º 21
0
        public static OSD ChatterBoxSessionStartReply(string groupName, UUID groupID)
        {
            OSDMap moderatedMap = new OSDMap(4)
            {
                { "voice", OSD.FromBoolean(false) }
            };

            OSDMap sessionMap = new OSDMap(4)
            {
                { "moderated_mode", moderatedMap },
                { "session_name", OSD.FromString(groupName) },
                { "type", OSD.FromInteger(0) },
                { "voice_enabled", OSD.FromBoolean(false) }
            };

            OSDMap bodyMap = new OSDMap(4)
            {
                { "session_id", OSD.FromUUID(groupID) },
                { "temp_session_id", OSD.FromUUID(groupID) },
                { "success", OSD.FromBoolean(true) },
                { "session_info", sessionMap }
            };

            return(buildEvent("ChatterBoxSessionStartReply", bodyMap));
        }
Exemplo n.º 22
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 OSDMap PackAgentCircuitData()
        {
            OSDMap args = new OSDMap();

            args["agent_id"]  = OSD.FromUUID(AgentID);
            args["caps_path"] = OSD.FromString(CapsPath);

            #region OPENSIM ONLY

            args["first_name"] = OSD.FromString(firstname);
            args["last_name"]  = OSD.FromString(lastname);

            #endregion

            args["child"]             = OSD.FromBoolean(child);
            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);

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

                OSDMap appmap = Appearance.Pack();
                args["packed_appearance"] = appmap;
            }

            return(args);
        }
Exemplo n.º 23
0
        public void SerializeArray()
        {
            OSDArray llsdEmptyArray = new OSDArray();
            byte[] binaryEmptyArraySerialized = OSDParser.SerializeLLSDBinary(llsdEmptyArray);
            Assert.AreEqual(binaryEmptyArray, binaryEmptyArraySerialized);

            binaryEmptyArraySerialized = OSDParser.SerializeLLSDBinary(llsdEmptyArray, false);
            Assert.AreEqual(binaryEmptyArrayValue, binaryEmptyArraySerialized);

            OSDArray llsdSimpleArray = new OSDArray();
            llsdSimpleArray.Add(OSD.FromInteger(0));
            byte[] binarySimpleArraySerialized = OSDParser.SerializeLLSDBinary(llsdSimpleArray);
            Assert.AreEqual(binarySimpleArray, binarySimpleArraySerialized);

            binarySimpleArraySerialized = OSDParser.SerializeLLSDBinary(llsdSimpleArray, false);
            Assert.AreEqual(binarySimpleArrayValue, binarySimpleArraySerialized);

            OSDArray llsdSimpleArrayTwo = new OSDArray();
            llsdSimpleArrayTwo.Add(OSD.FromInteger(0));
            llsdSimpleArrayTwo.Add(OSD.FromInteger(0));
            byte[] binarySimpleArrayTwoSerialized = OSDParser.SerializeLLSDBinary(llsdSimpleArrayTwo);
            Assert.AreEqual(binarySimpleArrayTwo, binarySimpleArrayTwoSerialized);

            binarySimpleArrayTwoSerialized = OSDParser.SerializeLLSDBinary(llsdSimpleArrayTwo, false);
            Assert.AreEqual(binarySimpleArrayTwoValue, binarySimpleArrayTwoSerialized);
        }
Exemplo n.º 24
0
        /// <summary>
        ///     Send back a user's display name
        /// </summary>
        /// <param name="newDisplayName"></param>
        /// <param name="oldDisplayName"></param>
        /// <param name="ID"></param>
        /// <param name="isDefault"></param>
        /// <param name="First"></param>
        /// <param name="Last"></param>
        /// <param name="Account"></param>
        /// <returns></returns>
        public OSD DisplayNameReply(string newDisplayName, string oldDisplayName, UUID ID, bool isDefault, string First,
                                    string Last, string Account)
        {
            OSDMap nameReply = new OSDMap();

            OSDMap body      = new OSDMap();
            OSDMap content   = new OSDMap();
            OSDMap agentData = new OSDMap();

            content.Add("display_name", OSD.FromString(newDisplayName));
            content.Add("display_name_next_update",
                        OSD.FromDate(
                            DateTime.ParseExact("1970-01-01 00:00:00 +0", "yyyy-MM-dd hh:mm:ss z",
                                                DateTimeFormatInfo.InvariantInfo).ToUniversalTime()));
            content.Add("id", OSD.FromUUID(ID));
            content.Add("is_display_name_default", OSD.FromBoolean(isDefault));
            content.Add("legacy_first_name", OSD.FromString(First));
            content.Add("legacy_last_name", OSD.FromString(Last));
            content.Add("username", OSD.FromString(Account));
            body.Add("content", content);
            body.Add("agent", agentData);
            body.Add("reason", OSD.FromString("OK"));
            body.Add("status", OSD.FromInteger(200));

            nameReply.Add("body", body);
            nameReply.Add("message", OSD.FromString("SetDisplayNameReply"));

            return(nameReply);
        }
Exemplo n.º 25
0
        /// <summary>
        ///     This method creates a smaller OSD that
        ///     does not contain sensitive information
        ///     if the trusted boolean is false
        /// </summary>
        /// <param name="trusted"></param>
        /// <returns></returns>
        public OSDMap ToOSD(bool trusted)
        {
            OSDMap map = new OSDMap
            {
                { "PrincipalID", OSD.FromUUID(PrincipalID) },
                { "AllowPublish", OSD.FromBoolean(AllowPublish) },
                { "MaturePublish", OSD.FromBoolean(MaturePublish) },
                { "WantToMask", OSD.FromUInteger(Interests.WantToMask) },
                { "WantToText", OSD.FromString(Interests.WantToText) },
                { "CanDoMask", OSD.FromUInteger(Interests.CanDoMask) },
                { "CanDoText", OSD.FromString(Interests.CanDoText) },
                { "Languages", OSD.FromString(Interests.Languages) },
                { "AboutText", OSD.FromString(AboutText) },
                { "FirstLifeImage", OSD.FromUUID(FirstLifeImage) },
                { "FirstLifeAboutText", OSD.FromString(FirstLifeAboutText) },
                { "Image", OSD.FromUUID(Image) },
                { "WebURL", OSD.FromString(WebURL) },
                { "Created", OSD.FromInteger(Created) },
                { "DisplayName", OSD.FromString(DisplayName) },
                { "Partner", OSD.FromUUID(Partner) },
                { "Visible", OSD.FromBoolean(Visible) },
                { "CustomType", OSD.FromString(CustomType) }
            };

            if (trusted)
            {
                map.Add("AArchiveName", OSD.FromString(AArchiveName));
                map.Add("IMViaEmail", OSD.FromBoolean(IMViaEmail));
                map.Add("IsNewUser", OSD.FromBoolean(IsNewUser));
                map.Add("MembershipGroup", OSD.FromString(MembershipGroup));
            }

            map.Add("Notes", OSD.FromString(OSDParser.SerializeJsonString(Notes)));
            return(map);
        }
        void ChatterBoxSessionStartReplyViaCaps(IClientAPI remoteClient, string groupName, UUID groupID)
        {
            if (m_debugEnabled)
            {
                m_log.DebugFormat("[Groups.Messaging]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            OSDMap moderatedMap = new OSDMap(4);

            moderatedMap.Add("voice", OSD.FromBoolean(false));

            OSDMap sessionMap = new OSDMap(4);

            sessionMap.Add("moderated_mode", moderatedMap);
            sessionMap.Add("session_name", OSD.FromString(groupName));
            sessionMap.Add("type", OSD.FromInteger(0));
            sessionMap.Add("voice_enabled", OSD.FromBoolean(false));

            OSDMap bodyMap = new OSDMap(4);

            bodyMap.Add("session_id", OSD.FromUUID(groupID));
            bodyMap.Add("temp_session_id", OSD.FromUUID(groupID));
            bodyMap.Add("success", OSD.FromBoolean(true));
            bodyMap.Add("session_info", sessionMap);

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

            queue?.Enqueue(queue.BuildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId);
        }
        public override OSDMap ToOSD()
        {
            OSDMap body = new OSDMap
            {
                { "MaxDragDistance", OSD.FromReal(MaxDragDistance) },
                { "DrawDistance", OSD.FromReal(DefaultDrawDistance) },
                { "ForceDrawDistance", OSD.FromInteger(ForceDrawDistance ? 1 : 0) },
                { "MaxPrimScale", OSD.FromReal(MaximumPrimScale) },
                { "MinPrimScale", OSD.FromReal(MinimumPrimScale) },
                { "MaxPhysPrimScale", OSD.FromReal(MaximumPhysPrimScale) },
                { "MaxHollowSize", OSD.FromReal(MaximumHollowSize) },
                { "MinHoleSize", OSD.FromReal(MinimumHoleSize) },
                { "EnforceMaxBuild", OSD.FromInteger(ClampPrimSizes ? 1 : 0) },
                { "MaxLinkCount", OSD.FromInteger(MaximumLinkCount) },
                { "MaxLinkCountPhys", OSD.FromInteger(MaximumLinkCountPhys) },
                { "LSLFunctions", LSLCommands },
                { "RenderWater", OSD.FromInteger(RenderWater ? 1 : 0) },
                { "TerrainDetailScale", OSD.FromReal(TerrainDetailScale) },
                { "MaxInventoryItemsTransfer", OSD.FromInteger(MaximumInventoryItemsTransfer) },
                { "AllowMinimap", OSD.FromInteger(DisplayMinimap ? 1 : 0) },
                { "AllowPhysicalPrims", OSD.FromInteger(AllowPhysicalPrims ? 1 : 0) },
                { "OffsetOfUTC", OSD.FromInteger(OffsetOfUTC) },
                { "OffsetOfUTCDST", OSD.FromInteger(OffsetOfUTCDST ? 1 : 0) },
                { "ToggleTeenMode", OSD.FromInteger(EnableTeenMode ? 1 : 0) },
                { "SetTeenMode", OSD.FromInteger(SetTeenMode ? 1 : 0) },
                { "ShowTags", OSD.FromInteger(ShowTags) },
                { "MaxGroups", OSD.FromInteger(MaxGroups) },
                { "AllowParcelWindLight", OSD.FromInteger(AllowParcelWindLight ? 1 : 0) }
            };

            return(body);
        }
Exemplo n.º 28
0
        public void SerializeMap()
        {
            OSDMap llsdOne   = new OSDMap();
            string sOne      = OSDParser.SerializeLLSDNotation(llsdOne);
            OSDMap llsdOneDS = (OSDMap)OSDParser.DeserializeLLSDNotation(sOne);

            Assert.AreEqual(OSDType.Map, llsdOneDS.Type);
            Assert.AreEqual(0, llsdOneDS.Count);

            OSD    llsdTwo   = OSD.FromInteger(123234);
            OSD    llsdThree = OSD.FromString("asedkfjhaqweiurohzasdf");
            OSDMap llsdFour  = new OSDMap();

            llsdFour["test0"] = llsdTwo;
            llsdFour["test1"] = llsdThree;

            llsdOne["test0"] = llsdTwo;
            llsdOne["test1"] = llsdThree;
            llsdOne["test2"] = llsdFour;

            string sFive    = OSDParser.SerializeLLSDNotation(llsdOne);
            OSDMap llsdFive = (OSDMap)OSDParser.DeserializeLLSDNotation(sFive);

            Assert.AreEqual(OSDType.Map, llsdFive.Type);
            Assert.AreEqual(3, llsdFive.Count);
            Assert.AreEqual(OSDType.Integer, llsdFive["test0"].Type);
            Assert.AreEqual(123234, llsdFive["test0"].AsInteger());
            Assert.AreEqual(OSDType.String, llsdFive["test1"].Type);
            Assert.AreEqual("asedkfjhaqweiurohzasdf", llsdFive["test1"].AsString());

            OSDMap llsdSix = (OSDMap)llsdFive["test2"];

            Assert.AreEqual(OSDType.Map, llsdSix.Type);
            Assert.AreEqual(2, llsdSix.Count);
            Assert.AreEqual(OSDType.Integer, llsdSix["test0"].Type);
            Assert.AreEqual(123234, llsdSix["test0"].AsInteger());
            Assert.AreEqual(OSDType.String, llsdSix["test1"].Type);
            Assert.AreEqual("asedkfjhaqweiurohzasdf", llsdSix["test1"].AsString());

            // We test here also for 4byte characters as map keys
            string xml = "<x>&#x10137;</x>";

            byte[]        bytes = Encoding.UTF8.GetBytes(xml);
            XmlTextReader xtr   = new XmlTextReader(new MemoryStream(bytes, false));

            xtr.Read();
            xtr.Read();
            string content = xtr.ReadString();

            OSDMap llsdSeven = new OSDMap();

            llsdSeven[content] = OSD.FromString(content);
            string sSeven      = OSDParser.SerializeLLSDNotation(llsdSeven);
            OSDMap llsdSevenDS = (OSDMap)OSDParser.DeserializeLLSDNotation(sSeven);

            Assert.AreEqual(OSDType.Map, llsdSevenDS.Type);
            Assert.AreEqual(1, llsdSevenDS.Count);
            Assert.AreEqual(content, llsdSevenDS[content].AsString());
        }
Exemplo n.º 29
0
        public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint)
        {
            uint xstart = 0;
            uint ystart = 0;

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

            OSDMap responsemap               = new OSDMap();
            List <ScenePresence> avatars     = m_scene.GetAvatars();
            OSDArray             responsearr = new OSDArray(avatars.Count);
            OSDMap responsemapdata           = new OSDMap();
            int    tc = Environment.TickCount;

            /*
             * foreach (ScenePresence av in avatars)
             * {
             *  responsemapdata = new OSDMap();
             *  responsemapdata["X"] = OSD.FromInteger((int)(xstart + av.AbsolutePosition.X));
             *  responsemapdata["Y"] = OSD.FromInteger((int)(ystart + av.AbsolutePosition.Y));
             *  responsemapdata["ID"] = OSD.FromUUID(UUID.Zero);
             *  responsemapdata["Name"] = OSD.FromString("TH");
             *  responsemapdata["Extra"] = OSD.FromInteger(0);
             *  responsemapdata["Extra2"] = OSD.FromInteger(0);
             *  responsearr.Add(responsemapdata);
             * }
             * responsemap["1"] = responsearr;
             */
            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)
                {
                    responsemapdata           = new OSDMap();
                    responsemapdata["X"]      = OSD.FromInteger((int)(xstart + av.AbsolutePosition.X));
                    responsemapdata["Y"]      = OSD.FromInteger((int)(ystart + av.AbsolutePosition.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.º 30
0
        /// <summary>
        /// Pack this object up as an OSDMap for transferring via LLSD XML or LLSD json
        /// </summary>
        /// <returns></returns>
        public OSDMap PackUpdateMessage()
        {
            OSDMap anim = new OSDMap();

            anim["animation"] = OSD.FromUUID(animID);
            anim["object_id"] = OSD.FromUUID(objectID);
            anim["seq_num"]   = OSD.FromInteger(sequenceNum);
            return(anim);
        }