public bool CanInstantMessage(UUID user, UUID target)
        {
            InstantMessageHandler handler = OnInstantMessage;

            if (handler != null)
            {
                Delegate[] list = handler.GetInvocationList();
                return(list.Cast <InstantMessageHandler>().All(h => h(user, target, m_scene) != false));
            }
            return(true);
        }
示例#2
0
        public void RemoveListener(InstantMessageType type, InstantMessageHandler handler)
        {
            InstantMessageHandler messageHandler;

            if (handlerRegistry.TryGetValue(type, out messageHandler))
            {
                if (messageHandler != null)
                {
                    //Debug.Log("Removing a handler for " + type.ToString() + ": " + handler.Method.Name);
                    handlerRegistry[type] -= handler;
                }
            }
        }
示例#3
0
        public bool CanInstantMessage(UUID user, UUID target)
        {
            InstantMessageHandler handler = OnInstantMessage;

            if (handler != null)
            {
                Delegate[] list = handler.GetInvocationList();
                foreach (InstantMessageHandler h in list)
                {
                    if (h(user, target, m_scene) == false)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
示例#4
0
        public void AddListener(InstantMessageType type, InstantMessageHandler handler)
        {
            InstantMessageHandler messageHandler;

            if (handlerRegistry.TryGetValue(type, out messageHandler))
            {
                if (messageHandler == null)
                {
                    //Debug.Log("Setting new handler for " + type.ToString() + ": " + handler.Method.Name);
                    handlerRegistry[type] = handler;
                }
                else
                {
                    //Debug.Log("Adding new handler for " + type.ToString() + ": " + handler.Method.Name);
                    handlerRegistry[type] += handler;
                }
            }
        }
示例#5
0
 public void ClearRegistry()
 {
     if (handlerRegistry != null)
     {
         foreach (InstantMessageType type in handlerRegistry.Keys)
         {
             InstantMessageHandler messageHandler = handlerRegistry[type];
             if (messageHandler != null)
             {
                 foreach (InstantMessageHandler handler in messageHandler.GetInvocationList())
                 {
                     messageHandler -= handler;
                 }
             }
             handlerRegistry.Remove(type);
         }
     }
 }