public void InstantMessage(UUID target, string message) { OnInstantMessage(this, new GridInstantMessage(m_scene, m_uuid, m_firstname + " " + m_lastname, target, 0, false, message, UUID.Zero, false, Position, new byte[0])); }
public bool Charge(UUID agentID, int amount, string text, int daysUntilNextCharge, TransactionType type, string identifer, bool chargeImmediately) { IMoneyModule moneyModule = m_registry.RequestModuleInterface<IMoneyModule>(); if (moneyModule != null) { if (chargeImmediately) { bool success = moneyModule.Charge(agentID, amount, text, type); if (!success) return false; } IScheduleService scheduler = m_registry.RequestModuleInterface<IScheduleService>(); if (scheduler != null) { OSDMap itemInfo = new OSDMap(); itemInfo.Add("AgentID", agentID); itemInfo.Add("Amount", amount); itemInfo.Add("Text", text); itemInfo.Add("Type", (int)type); SchedulerItem item = new SchedulerItem("ScheduledPayment " + identifer, OSDParser.SerializeJsonString(itemInfo), false, DateTime.UtcNow, daysUntilNextCharge, RepeatType.days, agentID); itemInfo.Add("SchedulerID", item.id); scheduler.Save(item); } } return true; }
public void FloodEffect (ITerrainChannel map, UUID userID, float north, float west, float south, float east, float strength) { float sum = 0; float steps = 0; int x, y; for (x = (int)west; x < (int)east; x++) { for (y = (int)south; y < (int)north; y++) { if (!map.Scene.Permissions.CanTerraformLand (userID, new Vector3 (x, y, 0))) continue; sum += map [x, y]; steps += 1; } } float avg = sum / steps; float str = 0.1f * strength; // == 0.2 in the default client for (x = (int)west; x < (int)east; x++) { for (y = (int)south; y < (int)north; y++) { if (!map.Scene.Permissions.CanTerraformLand (userID, new Vector3 (x, y, 0))) continue; map [x, y] = (map [x, y] * (1 - str)) + (avg * str); } } }
public AvatarAppearance GetAppearance(UUID principalID) { AvatarData avatar = GetAvatar(principalID); if (avatar == null || avatar.Data.Count == 0) return null; return avatar.ToAvatarAppearance(principalID); }
public AvatarAppearance GetAndEnsureAppearance(UUID principalID, string defaultUserAvatarArchive, out bool loadedArchive) { loadedArchive = false; AvatarAppearance avappearance = GetAppearance(principalID); if (avappearance == null) { //Create an appearance for the user if one doesn't exist if (defaultUserAvatarArchive != "") { AvatarArchive arch = m_ArchiveService.LoadAvatarArchive(defaultUserAvatarArchive, principalID); if (arch != null) { avappearance = arch.Appearance; SetAppearance(principalID, avappearance); loadedArchive = true; } } if(avappearance == null)//Set as ruth { avappearance = new AvatarAppearance(principalID); SetAppearance(principalID, avappearance); } } return avappearance; }
public AuthenticationData Get(UUID principalID) { if (m_DataByUUID.ContainsKey(principalID)) return m_DataByUUID[principalID]; return null; }
private string UserAssetURL(UUID userID) { CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); if (uinfo != null) return (uinfo.UserProfile.UserAssetURI == "") ? null : uinfo.UserProfile.UserAssetURI; return null; }
public Link( uint folderID, Guid objectGUID, uint objectFolderTypeID, DateTime dateCreated ) { FolderID = folderID; ObjectGUID = new UUID( objectGUID.ToByteArray() ).ToString(); ObjectFolderTypeID = objectFolderTypeID; DateCreated = dateCreated; }
public FriendInfo[] GetFriends(UUID principalID) { List<FriendInfo> infos = new List<FriendInfo>(); List<string> query = GD.Query("PrincipalID", principalID, m_realm, "Friend,Flags"); //These are used to get the other flags below List<string> keys = new List<string>(); List<object> values = new List<object>(); for (int i = 0; i < query.Count; i += 2) { FriendInfo info = new FriendInfo(); info.PrincipalID = principalID; info.Friend = query[i]; info.MyFlags = int.Parse(query[i + 1]); infos.Add(info); keys.Add("PrincipalID"); keys.Add("Friend"); values.Add(info.Friend); values.Add(info.PrincipalID); List<string> query2 = GD.Query(keys.ToArray(), values.ToArray(), m_realm, "Flags"); if (query2.Count >= 1) infos[infos.Count - 1].TheirFlags = int.Parse(query2[0]); keys = new List<string>(); values = new List<object>(); } return infos.ToArray(); }
public string Authenticate(UUID principalID, string password, int lifetime) { AuthenticationData data = m_Database.Get(principalID); string result = String.Empty; if (data != null && data.Data != null) { if (data.Data.ContainsKey("webLoginKey")) { m_log.DebugFormat("[AUTH SERVICE]: Attempting web key authentication for PrincipalID {0}", principalID); result = m_svcChecks["web_login_key"].Authenticate(principalID, password, lifetime); if (result == String.Empty) { m_log.DebugFormat("[AUTH SERVICE]: Web Login failed for PrincipalID {0}", principalID); } } if (result == string.Empty && data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt")) { m_log.DebugFormat("[AUTH SERVICE]: Attempting password authentication for PrincipalID {0}", principalID); result = m_svcChecks["password"].Authenticate(principalID, password, lifetime); if (result == String.Empty) { m_log.DebugFormat("[AUTH SERVICE]: Password login failed for PrincipalID {0}", principalID); } } if (result == string.Empty) { m_log.DebugFormat("[AUTH SERVICE]: Both password and webLoginKey-based authentication failed for PrincipalID {0}", principalID); } } else { m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); } return result; }
public override PhysicsCharacter AddAvatar(string avName, Vector3 position, Quaternion rotation, Vector3 size, bool isFlying, uint localID, UUID UUID) { BasicCharacterActor act = new BasicCharacterActor {Position = position, Flying = isFlying}; _actors.Add(act); return act; }
public override string Execute(string[] args, UUID fromAgentID) { if (args.Length < 1) return "Usage: parceldetails parcelID (use parcelinfo to get ID)"; int parcelID; Parcel parcel; // test argument that is is a valid integer, then verify we have that parcel data stored in the dictionary if (Int32.TryParse(args[0], out parcelID) && Client.Network.CurrentSim.Parcels.TryGetValue(parcelID, out parcel)) { // this request will update the parcels dictionary Client.Parcels.PropertiesRequest(Client.Network.CurrentSim, parcelID, 0); // Use reflection to dynamically get the fields from the Parcel struct Type t = parcel.GetType(); System.Reflection.FieldInfo[] fields = t.GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public); StringBuilder sb = new StringBuilder(); foreach (System.Reflection.FieldInfo field in fields) { sb.AppendFormat("{0} = {1}" + System.Environment.NewLine, field.Name, field.GetValue(parcel)); } return sb.ToString(); } else { return String.Format("Unable to find Parcel {0} in Parcels Dictionary, Did you run parcelinfo to populate the dictionary first?", args[0]); } }
public void RequestGodlikePowers( UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) { ScenePresence sp = m_scene.GetScenePresence(agentID); if (sp != null) { if (godLike == false) { sp.GrantGodlikePowers(agentID, sessionID, token, godLike); return; } // First check that this is the sim owner if (m_scene.Permissions.IsGod(agentID)) { // Next we check for spoofing..... UUID testSessionID = sp.ControllingClient.SessionId; if (sessionID == testSessionID) { if (sessionID == controllingClient.SessionId) { //m_log.Info("godlike: " + godLike.ToString()); sp.GrantGodlikePowers(agentID, testSessionID, token, godLike); } } } else { if (m_dialogModule != null) m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); } } }
public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, UUID ItemID, int AssetType, string ItemName) { Dictionary<string, object> sendData = new Dictionary<string, object>(); sendData["METHOD"] = "AddGroupNotice"; sendData["requestingAgentID"] = requestingAgentID; sendData["groupID"] = groupID; sendData["noticeID"] = noticeID; sendData["fromName"] = fromName; sendData["subject"] = subject; sendData["message"] = message; sendData["ItemID"] = ItemID; sendData["AssetType"] = AssetType; sendData["ItemName"] = ItemName; string reqString = WebUtils.BuildXmlResponse(sendData); try { foreach (string m_ServerURI in m_ServerURIs) { AsynchronousRestObjectRequester.MakeRequest("POST", m_ServerURI + "/auroradata", reqString); } } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e.ToString()); } }
public UserProfileData GetUserByUUID(UUID user) { UserProfileData userProfile = null; m_userProfilesByUuid.TryGetValue(user, out userProfile); return userProfile; }
public UUID RegisterRequest(UUID primID, UUID itemID, string identifier) { DataserverRequest ds = new DataserverRequest(); ds.primID = primID; ds.itemID = itemID; ds.ID = UUID.Random(); ds.handle = identifier; ds.startTime = DateTime.Now; ds.IsCompleteAt = DateTime.Now.AddHours(1); ds.Reply = ""; lock (DataserverRequests) { if (DataserverRequests.ContainsKey(identifier)) return UUID.Zero; DataserverRequests[identifier] = ds; } //Make sure that the cmd handler thread is running m_ScriptEngine.MaintenanceThread.PokeThreads (); return ds.ID; }
public bool Charge(UUID agentID, int amount, string text, int daysUntilNextCharge) { IMoneyModule moneyModule = m_registry.RequestModuleInterface<IMoneyModule>(); if (moneyModule != null) { bool success = moneyModule.Charge(agentID, amount, text); if (!success) return false; IScheduleService scheduler = m_registry.RequestModuleInterface<IScheduleService>(); if (scheduler != null) { OSDMap itemInfo = new OSDMap(); itemInfo.Add("AgentID", agentID); itemInfo.Add("Amount", amount); itemInfo.Add("Text", text); SchedulerItem item = new SchedulerItem("ScheduledPayment", OSDParser.SerializeJsonString(itemInfo), false, DateTime.Now.AddDays(daysUntilNextCharge) - DateTime.Now); itemInfo.Add("SchedulerID", item.id); scheduler.Save(item); } } return true; }
/// <summary> /// Sends the details about what /// </summary> /// <param name="client"></param> /// <param name="agentID"></param> /// <param name="groupID"></param> /// <param name="transactionID"></param> /// <param name="sessionID"></param> /// <param name="currentInterval"></param> /// <param name="intervalDays"></param> private void client_OnGroupAccountDetailsRequest(IClientAPI client, UUID agentID, UUID groupID, UUID transactionID, UUID sessionID, int currentInterval, int intervalDays) { IGroupsModule groupsModule = client.Scene.RequestModuleInterface<IGroupsModule>(); if (groupsModule != null && groupsModule.GroupPermissionCheck(agentID, groupID, GroupPowers.Accountable)) { IMoneyModule moneyModule = client.Scene.RequestModuleInterface<IMoneyModule>(); if (moneyModule != null) { int amt = moneyModule.Balance(groupID); List<GroupAccountHistory> history = moneyModule.GetTransactions(groupID, agentID, currentInterval, intervalDays); history = (from h in history where h.Stipend select h).ToList(); //We don't want payments, we only want stipends which we sent to users GroupBalance balance = moneyModule.GetGroupBalance(groupID); client.SendGroupAccountingDetails(client, groupID, transactionID, sessionID, amt, currentInterval, intervalDays, Util.BuildYMDDateString( balance.StartingDate.AddDays(-currentInterval*intervalDays)), history.ToArray()); } else client.SendGroupAccountingDetails(client, groupID, transactionID, sessionID, 0, currentInterval, intervalDays, "Never", new GroupAccountHistory[0]); } }
public bool CheckToken(UUID principalID, string token, int lifetime) { if (m_Tokens.ContainsKey(principalID)) return m_Tokens[principalID] == token; return false; }
public void Init() { TestHelper.InMethod(); scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); interregionComms.Initialise(new IniConfigSource()); interregionComms.PostInitialise(); SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); SceneSetupHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); agent1 = UUID.Random(); agent2 = UUID.Random(); agent3 = UUID.Random(); random = new Random(); sog1 = NewSOG(UUID.Random(), scene, agent1); sog2 = NewSOG(UUID.Random(), scene, agent1); sog3 = NewSOG(UUID.Random(), scene, agent1); //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); region1 = scene.RegionInfo.RegionHandle; region2 = scene2.RegionInfo.RegionHandle; region3 = scene3.RegionInfo.RegionHandle; }
public bool Get(UUID userID, out UserAccount account) { if (m_UUIDCache.TryGetValue(userID, out account)) return true; return false; }
public override string Execute(string[] args, UUID fromAgentID) { string inventoryName; uint timeout; string fileName; if (args.Length != 3) return "Usage: uploadimage [inventoryname] [timeout] [filename]"; TextureID = UUID.Zero; inventoryName = args[0]; fileName = args[2]; if (!UInt32.TryParse(args[1], out timeout)) return "Usage: uploadimage [inventoryname] [timeout] [filename]"; Console.WriteLine("Loading image " + fileName); byte[] jpeg2k = LoadImage(fileName); if (jpeg2k == null) return "Failed to compress image to JPEG2000"; Console.WriteLine("Finished compressing image to JPEG2000, uploading..."); start = DateTime.Now; DoUpload(jpeg2k, inventoryName); if (UploadCompleteEvent.WaitOne((int)timeout, false)) { return String.Format("Texture upload {0}: {1}", (TextureID != UUID.Zero) ? "succeeded" : "failed", TextureID); } else { return "Texture upload timed out"; } }
public void KickUser(UUID avatarID, string message) { //Get required interfaces IClientCapsService client = m_capsService.GetClientCapsService(avatarID); if (client != null) { IRegionClientCapsService regionClient = client.GetRootCapsService(); if (regionClient != null) { //Send the message to the client m_messagePost.Get(regionClient.Region.ServerURI, BuildRequest("KickUserMessage", message, regionClient.AgentID.ToString()), (resp) => { IAgentProcessing agentProcessor = m_registry.RequestModuleInterface<IAgentProcessing>(); if (agentProcessor != null) agentProcessor.LogoutAgent(regionClient, true); MainConsole.Instance.Info("User has been kicked."); }); return; } } MainConsole.Instance.Info("Could not find user to send message to."); }
public CityMap(uint regionCount, UUID estateOwner, UUID avatar, List<Scene> centers, List<float> regionDensities, uint mapSeed) { // Force the size of the city to be at least 1 region in size. If a list of regions // has been provided then make sure it is at least that long. if (regionCount <= 0) { // if (centralRegions.Count > 1) // regionCount = centers.Count; // else regionCount = 1; } // Allocate the space required for the number of regions specified. cityRegions = new Scene[regionCount, regionCount]; plotArray = new int[regionCount, regionCount]; if ( centralRegions.Capacity > 0 ) { centralRegions.Clear(); } centralRegions = new List<Scene>(); foreach (Scene s in centers) { centralRegions.Add(s); } }
public void BeginDecode(UUID assetID, byte[] j2kData, DecodedCallback callback) { OpenJPEG.J2KLayerInfo[] result; // If it's cached, return the cached results if (m_decodedCache.TryGetValue(assetID, out result)) { callback(assetID, result); } else { // Not cached, we need to decode it. // Add to notify list and start decoding. // Next request for this asset while it's decoding will only be added to the notify list // once this is decoded, requests will be served from the cache and all clients in the notifylist will be updated bool decode = false; lock (m_notifyList) { if (m_notifyList.ContainsKey(assetID)) { m_notifyList[assetID].Add(callback); } else { List<DecodedCallback> notifylist = new List<DecodedCallback> {callback}; m_notifyList.Add(assetID, notifylist); decode = true; } } // Do Decode! if (decode) DoJ2KDecode(assetID, j2kData); } }
public bool Delete(UUID ownerID, string friend) { QueryFilter filter = new QueryFilter(); filter.andFilters["PrincipalID"] = ownerID; filter.andFilters["Friend"] = friend; return GD.Delete(m_realm, filter); }
/// <summary> /// Get a user's profile /// </summary> /// <param name="agentID"></param> /// <returns></returns> public IUserProfileInfo GetUserProfile(UUID agentID) { IUserProfileInfo UserProfile = new IUserProfileInfo(); //Try from the user profile first before getting from the DB if (UserProfilesCache.TryGetValue(agentID, out UserProfile)) return UserProfile; else { UserProfile = new IUserProfileInfo(); List<string> query = null; //Grab it from the almost generic interface query = GD.Query(new string[]{"ID", "`Key`"}, new object[]{agentID, "LLProfile"}, "userdata", "Value"); if (query == null || query.Count == 0) return null; //Pull out the OSDmap OSDMap profile = (OSDMap)OSDParser.DeserializeLLSDXml(query[0]); UserProfile.FromOSD(profile); //Add to the cache UserProfilesCache[agentID] = UserProfile; return UserProfile; } }
public IAgentInfo GetAgent(UUID agentID) { /*object remoteValue = DoRemoteForUser(agentID, agentID); if (remoteValue != null) return (IAgentInfo)remoteValue;*/ IAgentInfo agent = new IAgentInfo(); List<string> query = null; try { QueryFilter filter = new QueryFilter(); filter.andFilters["ID"] = agentID; filter.andFilters["`Key`"] = "AgentInfo"; query = GD.Query(new string[1] { "`Value`" }, "userdata", filter, null, null, null); } catch { } if (query == null || query.Count == 0) { return null; //Couldn't find it, return null then. } OSDMap agentInfo = (OSDMap) OSDParser.DeserializeLLSDXml(query[0]); agent.FromOSD(agentInfo); agent.PrincipalID = agentID; return agent; }
/// <summary> /// Called by code which actually renders the dynamic texture to supply texture data. /// </summary> /// <param name="id"></param> /// <param name="data"></param> public void ReturnData(UUID id, byte[] data) { DynamicTextureUpdater updater = null; lock (Updaters) { if (Updaters.ContainsKey(id)) { updater = Updaters[id]; } } if (updater != null) { if (RegisteredScenes.ContainsKey(updater.SimUUID)) { Scene scene = RegisteredScenes[updater.SimUUID]; updater.DataReceived(data, scene); } } if (updater.UpdateTimer == 0) { lock (Updaters) { if (!Updaters.ContainsKey(updater.UpdaterID)) { Updaters.Remove(updater.UpdaterID); } } } }
public override string Execute(string[] args, UUID fromAgentID) { if (args.Length < 1) return Description; string groupName = String.Empty; for (int i = 0; i < args.Length; i++) groupName += args[i] + " "; groupName = groupName.Trim(); UUID groupUUID = Client.GroupName2UUID(groupName); if (UUID.Zero != groupUUID) { Client.Groups.GroupLeaveReply += Groups_GroupLeft; Client.Groups.LeaveGroup(groupUUID); GroupsEvent.WaitOne(30000, false); Client.Groups.GroupLeaveReply -= Groups_GroupLeft; GroupsEvent.Reset(); Client.ReloadGroupsCache(); if (leftGroup) return Client.ToString() + " has left the group " + groupName; return "failed to leave the group " + groupName; } return Client.ToString() + " doesn't seem to be member of the group " + groupName; }