/********************************************** * OpenXMLRPCChannel * * Generate a UUID channel key and add it and * the prim id to dictionary <channelUUID, primUUID> * * A custom channel key can be proposed. * Otherwise, passing UUID.Zero will generate * and return a random channel * * First check if there is a channel assigned for * this itemID. If there is, then someone called * llOpenRemoteDataChannel twice. Just return the * original channel. Other option is to delete the * current channel and assign a new one. * * ********************************************/ public UUID OpenXMLRPCChannel(uint localID, UUID itemID, UUID channelID) { UUID newChannel = UUID.Zero; //Is a dupe? try { m_openChannels.ForEach(delegate(RPCChannelInfo ci) { if (ci.GetItemID().Equals(itemID)) { // return the original channel ID for this item throw new ThreadedClasses.ReturnValueException <UUID>(ci.GetChannelID()); } }); } catch (ThreadedClasses.ReturnValueException <UUID> e) { return(e.Value); } newChannel = (channelID == UUID.Zero) ? UUID.Random() : channelID; RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, newChannel); m_openChannels.Add(newChannel, rpcChanInfo); return(newChannel); }
public UUID GetUserIdByName(string firstName, string lastName) { // TODO: Optimize for reverse lookup if this gets used by non-console commands. try { m_UserCache.ForEach(delegate(UserData user) { if (user.FirstName == firstName && user.LastName == lastName) { throw new ThreadedClasses.ReturnValueException <UUID>(user.Id); } }); } catch (ThreadedClasses.ReturnValueException <UUID> e) { return(e.Value); } UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName); if (account != null) { return(account.PrincipalID); } return(UUID.Zero); }
private void HandleSendAppearanceCommand(string module, string[] cmd) { if (cmd.Length != 2 && cmd.Length < 4) { MainConsole.Instance.OutputFormat("Usage: appearance send [<first-name> <last-name>]"); return; } bool targetNameSupplied = false; string optionalTargetFirstName = null; string optionalTargetLastName = null; if (cmd.Length >= 4) { targetNameSupplied = true; optionalTargetFirstName = cmd[2]; optionalTargetLastName = cmd[3]; } m_scenes.ForEach(delegate(Scene scene) { if (targetNameSupplied) { ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName); if (sp != null && !sp.IsChildAgent) { MainConsole.Instance.OutputFormat( "Sending appearance information for {0} to all other avatars in {1}", sp.Name, scene.RegionInfo.RegionName); scene.AvatarFactory.SendAppearance(sp.UUID); } } else { scene.ForEachRootScenePresence( sp => { MainConsole.Instance.OutputFormat( "Sending appearance information for {0} to all other avatars in {1}", sp.Name, scene.RegionInfo.RegionName); scene.AvatarFactory.SendAppearance(sp.UUID); } ); } }); }
public void ForEachActor(Action <BSActor> act) { m_actors.ForEach(delegate(BSActor val) { act(val); }); }
/********************************************** * Remote Data Reply * * Response to RPC message * *********************************************/ public void RemoteDataReply(string channel, string message_id, string sdata, int idata) { UUID message_key = new UUID(message_id); UUID channel_key = new UUID(channel); RPCRequestInfo rpcInfo = null; if (message_key == UUID.Zero) { m_rpcPendingResponses.ForEach(delegate(RPCRequestInfo oneRpcInfo) { if (oneRpcInfo.GetChannelKey() == channel_key) { rpcInfo = oneRpcInfo; } }); } else { m_rpcPendingResponses.TryGetValue(message_key, out rpcInfo); } if (rpcInfo != null) { rpcInfo.SetStrRetval(sdata); rpcInfo.SetIntRetval(idata); rpcInfo.SetProcessed(true); m_rpcPendingResponses.Remove(message_key); } else { m_log.Warn("[XML RPC MODULE]: Channel or message_id not found"); } }
private SceneObjectPart findPrim(UUID objectID, out string ObjectRegionName) { try { m_Scenes.ForEach(delegate(Scene s) { SceneObjectPart part = s.GetSceneObjectPart(objectID); if (part != null) { string _ObjectRegionName = s.RegionInfo.RegionName; uint localX = s.RegionInfo.WorldLocX; uint localY = s.RegionInfo.WorldLocY; _ObjectRegionName = _ObjectRegionName + " (" + localX + ", " + localY + ")"; throw new ThreadedClasses.ReturnValueException <KeyValuePair <string, SceneObjectPart> >(new KeyValuePair <string, SceneObjectPart>(_ObjectRegionName, part)); } }); } catch (ThreadedClasses.ReturnValueException <KeyValuePair <string, SceneObjectPart> > e) { ObjectRegionName = e.Value.Key; return(e.Value.Value); } ObjectRegionName = string.Empty; return(null); }
private void ClientClosed(UUID agentID, Scene scene) { //m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); queues.Remove(agentID); List <UUID> removeitems = new List <UUID>(); m_AvatarQueueUUIDMapping.Remove(agentID); UUID searchval = UUID.Zero; removeitems.Clear(); m_QueueUUIDAvatarMapping.ForEach(delegate(KeyValuePair <UUID, UUID> kvp) { searchval = m_QueueUUIDAvatarMapping[kvp.Key]; if (searchval == agentID) { removeitems.Add(kvp.Key); } }); foreach (UUID ky in removeitems) { m_QueueUUIDAvatarMapping.Remove(ky); } // m_log.DebugFormat("[EVENTQUEUE]: Deleted queues for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); }
public void StopHttpRequestsForScript(UUID id) { List <UUID> keysToRemove = new List <UUID>(); m_pendingRequests.ForEach(delegate(HttpRequestClass req) { if (req.ItemID == id) { req.Stop(); keysToRemove.Add(req.ReqID); } }); keysToRemove.ForEach(keyToRemove => m_pendingRequests.Remove(keyToRemove)); }
///<summary> /// ///</summary> private void HandleMaptileRefresh(object sender, EventArgs ea) { // this approach is a bit convoluted becase we want to wait for the // first upload to happen on startup but after all the objects are // loaded and initialized if (m_lastrefresh > 0 && Environment.TickCount - m_lastrefresh < m_refreshtime) { return; } m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: map refresh!"); m_scenes.ForEach(delegate(Scene scene) { try { UploadMapTile(scene); } catch (Exception ex) { m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: something bad happened {0}", ex.Message); } }); m_lastrefresh = Environment.TickCount; }
public Delegate[] GetScriptInvocationList() { List <Delegate> ret = new List <Delegate>(); m_scriptInvocation.ForEach(delegate(ScriptInvocationData d) { ret.Add(d.ScriptInvocationDelegate); }); return(ret.ToArray()); }
protected void HandleShowEq(string module, string[] args) { MainConsole.Instance.OutputFormat("For scene {0}", m_scene.Name); queues.ForEach(delegate(KeyValuePair <UUID, ThreadedClasses.BlockingQueue <OSD> > kvp) { MainConsole.Instance.OutputFormat( "For agent {0} there are {1} messages queued for send.", kvp.Key, kvp.Value.Count); }); }
public Dictionary <UUID, XGroup> GetGroups() { Dictionary <UUID, XGroup> groupsClone = new Dictionary <UUID, XGroup>(); m_groups.ForEach(delegate(XGroup group) { groupsClone[group.groupID] = group.Clone(); }); return(groupsClone); }
public List <TimerInfo> GetTimersInfo() { List <TimerInfo> retList = new List <TimerInfo>(); Timers.ForEach(delegate(TimerInfo i) { retList.Add(i.Clone()); }); return(retList); }
// Get a region given its base coordinates. // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST // be the base coordinate of the region. public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) { GridRegion region = null; // First see if it's a neighbour, even if it isn't on this sim. // Neighbour data is cached in memory, so this is fast try { m_LocalCache.ForEach(delegate(RegionCache rcache) { region = rcache.GetRegionByPosition(x, y); if (region != null) { // m_log.DebugFormat("{0} GetRegionByPosition. Found region {1} in cache. Pos=<{2},{3}>", // LogHeader, region.RegionName, x, y); throw new ThreadedClasses.ReturnValueException <GridRegion>(region); } }); } catch (ThreadedClasses.ReturnValueException <GridRegion> e) { region = e.Value; } // Then try on this sim (may be a lookup in DB if this is using MySql). if (region == null) { region = m_GridService.GetRegionByPosition(scopeID, x, y); /* * if (region == null) * m_log.DebugFormat("{0} GetRegionByPosition. Region not found by grid service. Pos=<{1},{2}>", * LogHeader, x, y); * else * m_log.DebugFormat("{0} GetRegionByPosition. Requested region {1} from grid service. Pos=<{2},{3}>", * LogHeader, region.RegionName, x, y); */ } return(region); }
public void ResetAgentGroupChatSessions(string agentID) { m_groupsAgentsDroppedFromChatSession.ForEach(delegate(KeyValuePair <UUID, ThreadedClasses.RwLockedList <string> > kvp) { kvp.Value.Remove(agentID); }); m_groupsAgentsInvitedToChatSession.ForEach(delegate(KeyValuePair <UUID, ThreadedClasses.RwLockedList <string> > kvp) { kvp.Value.Remove(agentID); }); }
/// <summary> /// Delete all the folders and items in this folder. /// </summary> public void Purge() { m_childFolders.ForEach(delegate(InventoryFolderImpl folder) { folder.Purge(); }); m_childFolders.Clear(); Items.Clear(); }
public void Activate(UUID itemID, int handle) { try { m_listeners.ForEach(delegate(KeyValuePair <int, ThreadedClasses.RwLockedList <ListenerInfo> > lis) { lis.Value.ForEach(delegate(ListenerInfo li) { if (li.GetItemID().Equals(itemID) && li.GetHandle() == handle) { li.Activate(); // only one, bail out throw new ThreadedClasses.ReturnValueException <bool>(true); } }); }); } catch (ThreadedClasses.ReturnValueException <bool> ) { } }
public void HandleXfer(ulong xferID, uint packetID, byte[] data) { AssetXferUploader foundUploader = null; try { XferUploaders.ForEach(delegate(AssetXferUploader uploader) { // m_log.DebugFormat( // "[AGENT ASSETS TRANSACTIONS]: In HandleXfer, inspect xfer upload with xfer id {0}", // uploader.XferID); if (uploader.XferID == xferID) { throw new ThreadedClasses.ReturnValueException <AssetXferUploader>(uploader); } }); foundUploader = null; } catch (ThreadedClasses.ReturnValueException <AssetXferUploader> e) { foundUploader = e.Value; } if (foundUploader != null) { // m_log.DebugFormat( // "[AGENT ASSETS TRANSACTIONS]: Found xfer uploader for xfer id {0}, packet id {1}, data length {2}", // xferID, packetID, data.Length); foundUploader.HandleXferPacket(xferID, packetID, data); } else { // Check if the xfer is a terrain xfer IEstateModule estateModule = m_Scene.RequestModuleInterface <IEstateModule>(); if (estateModule != null) { if (estateModule.IsTerrainXfer(xferID)) { return; } } m_log.ErrorFormat( "[AGENT ASSET TRANSACTIONS]: Could not find uploader for xfer id {0}, packet id {1}, data length {2}", xferID, packetID, data.Length); } }
public void ScriptRemoved(UUID itemID) { // m_log.DebugFormat("[URL MODULE]: Removing script {0}", itemID); List <string> removeURLs = new List <string>(); m_UrlMap.ForEach(delegate(KeyValuePair <string, UrlData> url) { if (url.Value.itemID == itemID) { RemoveUrl(url.Value); removeURLs.Add(url.Key); foreach (UUID req in url.Value.requests.Keys) { m_RequestMap.Remove(req); } } }); foreach (string urlname in removeURLs) { m_UrlMap.Remove(urlname); } }
public InventoryItemBase FindAsset(UUID assetID) { try { Items.ForEach(delegate(InventoryItemBase item) { if (item.AssetID == assetID) { throw new ThreadedClasses.ReturnValueException <InventoryItemBase>(item); } }); } catch (ThreadedClasses.ReturnValueException <InventoryItemBase> e) { return(e.Value); } try { m_childFolders.ForEach(delegate(InventoryFolderImpl folder) { InventoryItemBase item = folder.FindAsset(assetID); if (item != null) { throw new ThreadedClasses.ReturnValueException <InventoryItemBase>(item); } }); } catch (ThreadedClasses.ReturnValueException <InventoryItemBase> e) { return(e.Value); } return(null); }
private ScenePresence GetUser(string firstName, string lastName) { try { m_scenes.ForEach(delegate(Scene scene) { ScenePresence user = scene.GetScenePresence(firstName, lastName); if (user != null && !user.IsChildAgent) { throw new ThreadedClasses.ReturnValueException <ScenePresence>(user); } }); } catch (ThreadedClasses.ReturnValueException <ScenePresence> e) { return(e.Value); } return(null); }
/// <summary> /// Return an LLSD-serializable Hashtable describing the /// capabilities and their handler details. /// </summary> /// <param name="excludeSeed">If true, then exclude the seed cap.</param> public Hashtable GetCapsDetails(bool excludeSeed, List <string> requestedCaps) { Hashtable caps = CapsHandlers.GetCapsDetails(excludeSeed, requestedCaps); m_pollServiceHandlers.ForEach(delegate(KeyValuePair <string, PollServiceEventArgs> kvp) { if (!requestedCaps.Contains(kvp.Key)) { return; } string hostName = m_httpListenerHostName; uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; string protocol = "http"; if (MainServer.Instance.UseSSL) { hostName = MainServer.Instance.SSLCommonName; port = MainServer.Instance.SSLPort; protocol = "https"; } caps[kvp.Key] = string.Format("{0}://{1}:{2}{3}", protocol, hostName, port, kvp.Value.Url); }); // Add the external too m_externalCapsHandlers.ForEach(delegate(KeyValuePair <string, string> kvp) { if (!requestedCaps.Contains(kvp.Key)) { return; } caps[kvp.Key] = kvp.Value; }); return(caps); }
public IXmlRpcRequestInfo GetNextCompletedRequest() { try { m_rpcPending.ForEach(delegate(UUID luid) { RPCRequestInfo tmpReq; if (m_rpcPending.TryGetValue(luid, out tmpReq)) { if (!tmpReq.IsProcessed()) { throw new ThreadedClasses.ReturnValueException <IXmlRpcRequestInfo>(tmpReq); } } }); } catch (ThreadedClasses.ReturnValueException <IXmlRpcRequestInfo> e) { return(e.Value); } return(null); }
public IServiceRequest GetNextCompletedSRDRequest() { try { m_pendingSRDResponses.ForEach(delegate(UUID luid) { SendRemoteDataRequest tmpReq; if (m_pendingSRDResponses.TryGetValue(luid, out tmpReq)) { if (tmpReq.Finished) { throw new ThreadedClasses.ReturnValueException <SendRemoteDataRequest>(tmpReq); } } }); } catch (ThreadedClasses.ReturnValueException <SendRemoteDataRequest> e) { return(e.Value); } return(null); }
public List <RegionData> Get(string regionName, UUID scopeID) { if (m_useStaticInstance && Instance != this) { return(Instance.Get(regionName, scopeID)); } // m_log.DebugFormat("[NULL REGION DATA]: Getting region {0}, scope {1}", regionName, scopeID); string cleanName = regionName.ToLower(); // Handle SQL wildcards const string wildcard = "%"; bool wildcardPrefix = false; bool wildcardSuffix = false; if (cleanName.Equals(wildcard)) { wildcardPrefix = wildcardSuffix = true; cleanName = string.Empty; } else { if (cleanName.StartsWith(wildcard)) { wildcardPrefix = true; cleanName = cleanName.Substring(1); } if (regionName.EndsWith(wildcard)) { wildcardSuffix = true; cleanName = cleanName.Remove(cleanName.Length - 1); } } Matcher queryMatch; if (wildcardPrefix && wildcardSuffix) { queryMatch = delegate(string s) { return(s.Contains(cleanName)); } } ; else if (wildcardSuffix) { queryMatch = delegate(string s) { return(s.StartsWith(cleanName)); } } ; else if (wildcardPrefix) { queryMatch = delegate(string s) { return(s.EndsWith(cleanName)); } } ; else { queryMatch = delegate(string s) { return(s.Equals(cleanName)); } }; // Find region data List <RegionData> ret = new List <RegionData>(); m_regionData.ForEach(delegate(RegionData r) { // m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower()); if (queryMatch(r.RegionName.ToLower())) { ret.Add(r); } }); if (ret.Count > 0) { return(ret); } return(null); }