public ActionExecutor(ref EventManager evMan)
        {
            this.evMan = evMan;

            consumerThread = new Thread(ProcessQueue) { IsBackground = true };
            consumerThread.Start();
        }
 internal void HandleEvent(EventType eventType, Room room, ref EventManager evMan, Dictionary<string, object> data)
 {
     events[eventType].Execute(room, ref evMan, data);
 }
Example #3
0
        /// <summary>
        /// Provides access to chat room functions, such as, message posting/editing/deleting/starring,
        /// user kick-muting/access level changing, basic message/user retrieval and the ability to subscribe to events.
        /// </summary>
        /// <param name="host">The host domain of the room (e.g., meta.stackexchange.com).</param>
        /// <param name="ID">The room's identification number.</param>
        public Room(string cookieKey, string host, int ID)
        {
            if (string.IsNullOrEmpty(cookieKey)) { throw new ArgumentNullException("cookieKey"); }
            if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("'host' must not be null or empty.", "host"); }
            if (ID < 0) { throw new ArgumentOutOfRangeException("ID", "'ID' must not be negative."); }

            this.ID = ID;
            this.cookieKey = cookieKey;
            evMan = new EventManager();
            actEx = new ActionExecutor(ref evMan);
            chatRoot = "http://chat." + host;
            throttleARE = new AutoResetEvent(false);
            socketRecTimeout = TimeSpan.FromMinutes(15);
            Host = host;
            IgnoreOwnEvents = true;
            StripMention = true;
            Me = GetMe();

            SetFkey();

            var count = GetGlobalEventCount();
            var url = GetSocketURL(count);

            InitialiseSocket(url);
        }