Process an invite event for this room.
 @param event [Hash] Event data.
548461
def process_invite_event(event)
      return unless event['type'] == 'm.room.member'
      return unless event['content']['membership'] == 'invite'
      @users.process_invite self, event
      sender = @users[event['sender']]
      invitee = @users[event['state_key']]
      # Return early if the user is already in the room
      return if @state.member? invitee
      broadcast(:invited, sender, invitee)
    end
881074
def manage_event(self, event) -> None:
        
        name = EVENT_NAME.format(
            topic=event[EVENT_TOPIC], source=event.get(EVENT_SOURCE_IDX))

        if event[EVENT_OPERATION] == 'Initialized' and name not in self.events:

            for event_class in EVENT_CLASSES:
                if event_class.TOPIC in event[EVENT_TOPIC]:
                    self.events[name] = event_class(event)
                    self.signal('add', name)
                    return

            _LOGGER.debug('Unsupported event %s', event[EVENT_TOPIC])

        elif event[EVENT_OPERATION] == 'Changed' and name in self.events:
            self.events[name].state = event[EVENT_VALUE]
571944
private void processInstanceContentEvent(InstancesContentEvent instContentEvent){
            this.numBatches++;
            this.contentEventList.add(instContentEvent);
            if (this.numBatches == 1 || this.numBatches > 4){
                this.processInstances(this.contentEventList.remove(0));
            }

            if (instContentEvent.isLastEvent()) {
                // drain remaining instances
                while (!contentEventList.isEmpty()) {
                    processInstances(contentEventList.remove(0));
                }
            }
                
        }
509105
def _parse_invite(client, command, actor, args):
    """"""
    target, _, channel = args.rpartition(" ")
    client.dispatch_event("INVITE", actor, target, channel.lower())
648515
def _handle_event(self, sid, namespace, id, data):
        """"""
        namespace = namespace or '/'
        self.logger.info('received event "%s" from %s [%s]', data[0], sid,
                         namespace)
        if self.async_handlers:
            self.start_background_task(self._handle_event_internal, self, sid,
                                       data, namespace, id)
        else:
            self._handle_event_internal(self, sid, data, namespace, id)
637515
def handle_event(event)
      if event.is_a?(Hash)
        if ["Push", "Request"].include?(event[:type])
          # Use next_tick to ensure that on main reactor thread
          # so that any data access is thread safe
          EM_S.next_tick do
            begin
              if (result = @dispatcher.dispatch(event_to_packet(event))) && event[:type] == "Request"
                @client.notify(result_to_event(result), [result.to])
              end
            rescue Dispatcher::DuplicateRequest
            rescue Exception => e
              ErrorTracker.log(self, "Failed sending response for <#{event[:uuid]}>", e)
            end
          end
        elsif event[:type] == "Result"
          if (data = event[:data]) && (result = data[:result]) && result.respond_to?(:non_delivery?) && result.non_delivery?
            Log.info("Non-delivery of event <#{data[:request_uuid]}>: #{result.content}")
          else
            ErrorTracker.log(self, "Unexpected Result event from #{event[:from]}: #{event.inspect}")
          end
        else
          ErrorTracker.log(self, "Unrecognized event type #{event[:type]} from #{event[:from]}")
        end
      else
        ErrorTracker.log(self, "Unrecognized event: #{event.class}")
      end
      nil
    end
878769
def on(event, &proc)
      unless @events.has_key? event
        raise Error, "`#{event}` is not a valid event type"
      end
      event_id = new_event_key
      @events[event][event_id] = proc
      EventDescriptor.new(event, event_id)
    end
1191547
def process(event, watch_type = nil)
      @zk.raw_event_handler(event)

      logger.debug { "EventHandler#process dispatching event for #{watch_type.inspect}: #{event.inspect}" }# unless event.type == -1
      event.zk = @zk

      cb_keys = 
        if event.node_event?
          [event.path, ALL_NODE_EVENTS_KEY]
        elsif event.session_event?
          [state_key(event.state), ALL_STATE_EVENTS_KEY]
        else
          raise ZKError, "don't know how to process event: #{event.inspect}"
        end

      cb_ary = synchronize do 
        clear_watch_restrictions(event, watch_type)

        @callbacks.values_at(*cb_keys)
      end

      cb_ary.flatten! # takes care of not modifying original arrays
      cb_ary.compact!

      # we only filter for node events
      if event.node_event?
        interest_key = event.interest_key
        cb_ary.select! { |sub| sub.interests.include?(interest_key) }
      end

      safe_call(cb_ary, event)
    end
796292
void processEvent(Event e) {
    assert !_processed;
    // Event e = _events[idx];
    if (e.isSend()) {
      _sends.put(e, new ArrayList<TimelineSnapshot.Event>());
      for (Event otherE : _events) {
        if ((otherE != null) && (otherE != e) && (!otherE.equals(e)) && otherE._blocked
          && otherE.match(e)) {
          _edges.put(otherE, e);
          _sends.get(e).add(otherE);
          otherE._blocked = false;
        }
      }
    } else { // look for matching send, otherwise set _blocked
      assert !_edges.containsKey(e);
      int senderIdx = e.packH2O().index();
      if (senderIdx < 0) { // binary search did not find member, should not happen?
        // no possible sender - return and do not block
        Log.warn("no sender found! port = " + e.portPack() + ", ip = " + e.addrPack().toString());
        return;
      }
      Event senderCnd = _events[senderIdx];
      if (senderCnd != null) {
        if (isSenderRecvPair(senderCnd, e)) {
          _edges.put(e, senderCnd.clone());
          _sends.get(senderCnd).add(e);
          return;
        }
        senderCnd = senderCnd.clone();
        while (senderCnd.prev()) {
          if (isSenderRecvPair(senderCnd, e)) {
            _edges.put(e, senderCnd);
            _sends.get(senderCnd).add(e);
            return;
          }
        }
      }
      e._blocked = true;
    }
    assert (e == null) || (e._eventIdx < TimeLine.MAX_EVENTS);
  }
1111556
def notify(event)
      fail NoEventError, 'Please pass an event object, not a class' if event.is_a?(Class)

      @handlers[event.class.to_s].each { |handler| handler.call(event) }
    end
1149835
function _sendEvent(client, room, event, callback) {
    // Add an extra Promise.resolve() to turn synchronous exceptions into promise rejections,
    // so that we can handle synchronous and asynchronous exceptions with the
    // same code path.
    return Promise.resolve().then(function() {
        const encryptionPromise = _encryptEventIfNeeded(client, event, room);

        if (!encryptionPromise) {
            return null;
        }

        _updatePendingEventStatus(room, event, EventStatus.ENCRYPTING);
        return encryptionPromise.then(() => {
            _updatePendingEventStatus(room, event, EventStatus.SENDING);
        });
    }).then(function() {
        let promise;
        // this event may be queued
        if (client.scheduler) {
            // if this returns a promsie then the scheduler has control now and will
            // resolve/reject when it is done. Internally, the scheduler will invoke
            // processFn which is set to this._sendEventHttpRequest so the same code
            // path is executed regardless.
            promise = client.scheduler.queueEvent(event);
            if (promise && client.scheduler.getQueueForEvent(event).length > 1) {
                // event is processed FIFO so if the length is 2 or more we know
                // this event is stuck behind an earlier event.
                _updatePendingEventStatus(room, event, EventStatus.QUEUED);
            }
        }

        if (!promise) {
            promise = _sendEventHttpRequest(client, event);
        }
        return promise;
    }).then(function(res) {  // the request was sent OK
        if (room) {
            room.updatePendingEvent(event, EventStatus.SENT, res.event_id);
        }
        if (callback) {
            callback(null, res);
        }
        return res;
    }, function(err) {
        // the request failed to send.
        console.error("Error sending event", err.stack || err);

        try {
            // set the error on the event before we update the status:
            // updating the status emits the event, so the state should be
            // consistent at that point.
            event.error = err;
            _updatePendingEventStatus(room, event, EventStatus.NOT_SENT);
            // also put the event object on the error: the caller will need this
            // to resend or cancel the event
            err.event = event;

            if (callback) {
                callback(err);
            }
        } catch (err2) {
            console.error("Exception in error handler!", err2.stack || err);
        }
        throw err;
    });
}
971339
def process_event(self, event, client, args, force_dispatch=False):
        
        if not self.running:
            _log.debug("Ignoring '%s' event - controller not running.", event)
            return

        # We keep a copy of the state of loaded modules before this event,
        # and restore it when we're done. This lets us handle events that
        # result in other events being dispatched in a graceful manner.
        old_loaded = self.loaded_on_this_event
        self.loaded_on_this_event = set(old_loaded or []) if not force_dispatch else set()

        try:
            _log.debug("Controller is dispatching '%s' event", event)
            for module_name in self.module_ordering:
                if module_name in self.loaded_on_this_event and not force_dispatch:
                    _log.debug("Not dispatching %s to '%s' because it was just "
                               "loaded (%r).", event, module_name,
                               self.loaded_on_this_event)
                    continue
                module = self.loaded_modules[module_name]
                if module.handle_event(event, client, args):
                    return True
        finally:
            self.loaded_on_this_event = old_loaded
653766
def _process_event(self, event):
        
        if event.get('user'):
            event.user = self.lookup_user(event.get('user'))

        if event.get('channel'):
            event.channel = self.lookup_channel(event.get('channel'))

        if self.user.id in event.mentions:
            event.mentions_me = True

        event.mentions = [ self.lookup_user(uid) for uid in event.mentions ]

        return event
111533
def process_key_event(self, event_data):
        '''
        
        '''

        tag = event_data['tag']
        event_info = event_data['data']

        if event_info['act'] == 'delete':
            self.minions.pop(event_info['id'], None)
        elif event_info['act'] == 'accept':
            self.minions.setdefault(event_info['id'], {})

        self.publish_minions()
282655
function(self, eventType, content) {
    return self.client.sendEvent(self.roomId, eventType, content);
}
295908
def process_event(event):
    
    if event.type == EventType.ON_CONVERSATION_TURN_STARTED:
        print()

    print(event)

    if (event.type == EventType.ON_CONVERSATION_TURN_FINISHED and
            event.args and not event.args['with_follow_on_turn']):
        print()
    if event.type == EventType.ON_DEVICE_ACTION:
        for command, params in event.actions:
            print('Do command', command, 'with params', str(params))
1182345
def handle_publish(client, data)
      topic_uri, payload, exclude, include = data

      @engine.create_event(client, topic_uri, payload, exclude, include)

      trigger(:publish, client, topic_uri, payload, exclude, include)
    end