示例#1
0
 protected void QueueMessage(ListenerInfo li)
 {
     //Make sure that the cmd handler thread is running
     m_scriptModule.PokeThreads(li.GetItemID());
     lock (m_pending.SyncRoot)
     {
         m_pending.Enqueue(li);
     }
 }
示例#2
0
        /// <summary>
        ///     Pop the first availlable listen event from the queue
        /// </summary>
        /// <returns>ListenerInfo with filter filled in</returns>
        public IWorldCommListenerInfo GetNextMessage()
        {
            ListenerInfo li = null;

            lock (m_pending.SyncRoot)
            {
                li = (ListenerInfo)m_pending.Dequeue();
            }

            return(li);
        }
示例#3
0
        public void AddFromData(UUID itemID, UUID hostID,
                                OSD data)
        {
            OSDMap save = (OSDMap)data;

            foreach (KeyValuePair <string, OSD> kvp in save)
            {
                OSDMap       item = (OSDMap)kvp.Value;
                ListenerInfo info = ListenerInfo.FromData(itemID, hostID, item);
                AddListener(info.GetItemID(), info.GetHostID(), info.GetChannel(), info.GetName(), info.GetID(),
                            info.GetMessage(), info.RegexBitfield);
            }
        }
示例#4
0
        public static ListenerInfo FromData(UUID ItemID, UUID hostID, OSDMap data)
        {
            int    Handle  = data["Handle"].AsInteger();
            int    Channel = data["Channel"].AsInteger();
            string Name    = data["Name"].AsString();
            string Message = data["Message"].AsString();
            UUID   ID      = data["ID"].AsUUID();
            bool   Active  = data["Active"].AsBoolean();

            ListenerInfo linfo = new ListenerInfo(Handle,
                                                  ItemID, hostID, Channel, Name,
                                                  ID, Message)
            {
                m_active = Active
            };

            return(linfo);
        }
示例#5
0
        public int AddListener(UUID itemID, UUID hostID, int channel, string name, UUID id, string msg, int regexBitfield)
        {
            // do we already have a match on this particular filter event?
            List <ListenerInfo> coll = GetListeners(itemID, channel, name, id, msg);

            if (coll.Count > 0)
            {
                // special case, called with same filter settings, return same handle
                // (2008-05-02, tested on 1.21.1 server, still holds)
                return(coll[0].GetHandle());
            }

            if (m_curlisteners < m_maxlisteners)
            {
                lock (m_listeners)
                {
                    int newHandle = GetNewHandle(itemID);

                    if (newHandle > 0)
                    {
                        ListenerInfo li = new ListenerInfo(newHandle, itemID, hostID, channel, name, id, msg, regexBitfield);

                        List <ListenerInfo> listeners;
                        if (!m_listeners.TryGetValue(channel, out listeners))
                        {
                            listeners = new List <ListenerInfo>();
                            m_listeners.Add(channel, listeners);
                        }
                        listeners.Add(li);
                        m_curlisteners++;

                        return(newHandle);
                    }
                }
            }
            return(-1);
        }
示例#6
0
 public ListenerInfo(ListenerInfo li, string name, UUID id, string message)
 {
     Initialise(li.m_handle, li.m_itemID, li.m_hostID, li.m_channel, name, id, message, 0);
 }
示例#7
0
        public static ListenerInfo FromData(UUID ItemID, UUID hostID, OSDMap data)
        {
            int Handle = data["Handle"].AsInteger();
            int Channel = data["Channel"].AsInteger();
            string Name = data["Name"].AsString();
            string Message = data["Message"].AsString();
            UUID ID = data["ID"].AsUUID();
            bool Active = data["Active"].AsBoolean();

            ListenerInfo linfo = new ListenerInfo(Handle,
                                                  ItemID, hostID, Channel, Name,
                                                  ID, Message) {m_active = Active};

            return linfo;
        }
示例#8
0
 public ListenerInfo(ListenerInfo li, string name, UUID id, string message)
 {
     Initialise(li.m_handle, li.m_itemID, li.m_hostID, li.m_channel, name, id, message);
 }
示例#9
0
        public int AddListener(UUID itemID, UUID hostID, int channel, string name, UUID id, string msg)
        {
            // do we already have a match on this particular filter event?
            List<ListenerInfo> coll = GetListeners(itemID, channel, name, id, msg);

            if (coll.Count > 0)
            {
                // special case, called with same filter settings, return same handle
                // (2008-05-02, tested on 1.21.1 server, still holds)
                return coll[0].GetHandle();
            }

            if (m_curlisteners < m_maxlisteners)
            {
                lock (m_listeners)
                {
                    int newHandle = GetNewHandle(itemID);

                    if (newHandle > 0)
                    {
                        ListenerInfo li = new ListenerInfo(newHandle, itemID, hostID, channel, name, id, msg);

                        List<ListenerInfo> listeners;
                        if (!m_listeners.TryGetValue(channel, out listeners))
                        {
                            listeners = new List<ListenerInfo>();
                            m_listeners.Add(channel, listeners);
                        }
                        listeners.Add(li);
                        m_curlisteners++;

                        return newHandle;
                    }
                }
            }
            return -1;
        }
示例#10
0
 protected void QueueMessage(ListenerInfo li)
 {
     //Make sure that the cmd handler thread is running
     m_scriptModule.PokeThreads(li.GetItemID());
     lock (m_pending.SyncRoot)
     {
         m_pending.Enqueue(li);
     }
 }