public GetListeners ( UUID itemID, int channel, string name, UUID id, string msg ) : List |
||
itemID | UUID | |
channel | int | |
name | string | |
id | UUID | |
msg | string | |
Результат | List |
/// <summary> /// This method scans over the objects which registered an interest in listen callbacks. /// For everyone it finds, it checks if it fits the given filter. If it does, then /// enqueue the message for delivery to the objects listen event handler. /// The enqueued ListenerInfo no longer has filter values, but the actually trigged values. /// Objects that do an llSay have their messages delivered here and for nearby avatars, /// the OnChatFromClient event is used. /// </summary> /// <param name="type">type of delvery (whisper,say,shout or regionwide)</param> /// <param name="channel">channel to sent on</param> /// <param name="name">name of sender (object or avatar)</param> /// <param name="id">key of sender (object or avatar)</param> /// <param name="msg">msg to sent</param> public void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg, Vector3 position) { // m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}", // type, channel, name, id, msg); // Determine which listen event filters match the given set of arguments, this results // in a limited set of listeners, each belonging a host. If the host is in range, add them // to the pending queue. foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) { // Dont process if this message is from yourself! if (li.GetHostID().Equals(id)) { continue; } SceneObjectPart sPart = m_scene.GetSceneObjectPart( li.GetHostID()); if (sPart == null) { continue; } double dis = Util.GetDistanceTo(sPart.AbsolutePosition, position); switch (type) { case ChatTypeEnum.Whisper: if (dis < m_whisperdistance) { QueueMessage(new ListenerInfo(li, name, id, msg)); } break; case ChatTypeEnum.Say: if (dis < m_saydistance) { QueueMessage(new ListenerInfo(li, name, id, msg)); } break; case ChatTypeEnum.Shout: if (dis < m_shoutdistance) { QueueMessage(new ListenerInfo(li, name, id, msg)); } break; case ChatTypeEnum.Region: QueueMessage(new ListenerInfo(li, name, id, msg)); break; } } }
/// <summary> /// This method scans over the objects which registered an interest in listen callbacks. /// For everyone it finds, it checks if it fits the given filter. If it does, then /// enqueue the message for delivery to the objects listen event handler. /// The enqueued ListenerInfo no longer has filter values, but the actually trigged values. /// Objects that do an llSay have their messages delivered here and for nearby avatars, /// the OnChatFromClient event is used. /// </summary> /// <param name="type">type of delvery (whisper,say,shout or regionwide)</param> /// <param name="channel">channel to sent on</param> /// <param name="name">name of sender (object or avatar)</param> /// <param name="id">key of sender (object or avatar)</param> /// <param name="msg">msg to sent</param> public void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg, Vector3 position, UUID destId) { // m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}", // type, channel, name, id, msg); // Determine which listen event filters match the given set of arguments, this results // in a limited set of listeners, each belonging a host. If the host is in range, add them // to the pending queue. foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) { // Dont process if this message is from yourself! if (li.GetHostID().Equals(id)) { continue; } ISceneEntity entity = m_scene.GetSceneObjectPart(li.GetHostID()); if (entity == null) { entity = m_scene.GetScenePresence(li.GetHostID()); if (entity == null) { continue; } } // Don't process if this message is for a specific other listener if (destId != UUID.Zero) { // Addressed to a specific recipient if (!DestIdMatches(destId, entity)) { continue; } } // Use the position of the root prim for all listens, as per SL semantics and docs. Fixes Mantis #1895. double dis = Util.GetDistanceTo(GetAbsolutePosition(entity), position); switch (type) { case ChatTypeEnum.Whisper: if (dis < m_whisperdistance) { lock (m_pending.SyncRoot) { m_pending.Enqueue(new ListenerInfo(li, name, id, msg)); _workArrivedDelegate(); } } break; case ChatTypeEnum.Say: if (dis < m_saydistance) { lock (m_pending.SyncRoot) { m_pending.Enqueue(new ListenerInfo(li, name, id, msg)); _workArrivedDelegate(); } } break; case ChatTypeEnum.Shout: if (dis < m_shoutdistance) { lock (m_pending.SyncRoot) { m_pending.Enqueue(new ListenerInfo(li, name, id, msg)); _workArrivedDelegate(); } } break; case ChatTypeEnum.Region: case ChatTypeEnum.Direct: lock (m_pending.SyncRoot) { m_pending.Enqueue(new ListenerInfo(li, name, id, msg)); _workArrivedDelegate(); } break; } } }
/// <summary> /// This method scans over the objects which registered an interest in listen callbacks. /// For everyone it finds, it checks if it fits the given filter. If it does, then /// enqueue the message for delivery to the objects listen event handler. /// The enqueued ListenerInfo no longer has filter values, but the actually trigged values. /// Objects that do an llSay have their messages delivered here and for nearby avatars, /// the OnChatFromClient event is used. /// </summary> /// <param name="type">type of delvery (whisper,say,shout or regionwide)</param> /// <param name="channel">channel to sent on</param> /// <param name="name">name of sender (object or avatar)</param> /// <param name="id">key of sender (object or avatar)</param> /// <param name="msg">msg to sent</param> public void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg, Vector3 position) { // m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}", // type, channel, name, id, msg); // validate type and set range float maxDistanceSQ; switch (type) { case ChatTypeEnum.Whisper: maxDistanceSQ = m_whisperdistance; break; case ChatTypeEnum.Say: maxDistanceSQ = m_saydistance; break; case ChatTypeEnum.Shout: maxDistanceSQ = m_shoutdistance; break; case ChatTypeEnum.Region: maxDistanceSQ = -1f; break; default: return; } // Determine which listen event filters match the given set of arguments, this results // in a limited set of listeners, each belonging a host. If the host is in range, add them // to the pending queue. UUID hostID; foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) { hostID = li.GetHostID(); // Dont process if this message is from yourself! if (id == hostID) { continue; } if (maxDistanceSQ < 0) { QueueMessage(new ListenerInfo(li, name, id, msg)); continue; } SceneObjectPart sPart = m_scene.GetSceneObjectPart(hostID); if (sPart == null) { continue; } if (maxDistanceSQ > Vector3.DistanceSquared(sPart.AbsolutePosition, position)) { QueueMessage(new ListenerInfo(li, name, id, msg)); } } }