Redacts the message with specified event_id for the given reason.

        See https://matrix.org/docs/spec/r0.0.1/client_server.html#id112
6461
def redact_message(self, event_id, reason=None):
        
        return self.client.api.redact_event(self.room_id, event_id, reason)
584013
def delete_message(self, id, remove):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - id
        """ID"""
        path["id"] = id

        # REQUIRED - remove
        """Array of message ids to be deleted"""
        data["remove"] = remove

        self.logger.debug("POST /api/v1/conversations/{id}/remove_messages with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("POST", "/api/v1/conversations/{id}/remove_messages".format(**path), data=data, params=params, no_data=True)
115522
def discard_event(event: events.Event, bot_id: str = None) -> bool:
    
    if event["type"] in SKIP_EVENTS:
        return True
    elif bot_id and isinstance(event, events.Message):
        if event.get("bot_id") == bot_id:
            LOG.debug("Ignoring event: %s", event)
            return True
        elif "message" in event and event["message"].get("bot_id") == bot_id:
            LOG.debug("Ignoring event: %s", event)
            return True
    return False
615711
def post_event_cancel(self, id, **data):
        
        
        return self.post("/events/{0}/cancel/".format(id), data=data)
1069149
def process_event(message_id, event_type, event_detail, timestamp):
    
    # Load message
    try:
        message = Outbound.objects.select_related("channel").get(
            vumi_message_id=message_id
        )
    except ObjectDoesNotExist:
        return (False, "Cannot find message for ID {}".format(message_id))

    if event_type == "ack":
        message.delivered = True
        message.to_addr = ""
        message.metadata["ack_timestamp"] = timestamp
        message.metadata["ack_reason"] = event_detail
        message.save(update_fields=["delivered", "to_addr", "metadata"])
    elif event_type == "nack":
        message.metadata["nack_timestamp"] = timestamp
        message.metadata["nack_reason"] = event_detail
        message.save(update_fields=["metadata"])

        decr_message_count(message)

        send_message.delay(str(message.id))
    elif event_type == "delivery_succeeded":
        message.delivered = True
        message.to_addr = ""
        message.metadata["delivery_timestamp"] = timestamp
        message.metadata["delivery_reason"] = event_detail
        message.save(update_fields=["delivered", "metadata", "to_addr"])
    elif event_type == "delivery_failed":
        message.metadata["delivery_failed_reason"] = event_detail
        message.metadata["delivery_failed_timestamp"] = timestamp
        message.save(update_fields=["metadata"])

        decr_message_count(message)

        send_message.delay(str(message.id))
    elif event_type == "read":
        message.delivered = True
        message.to_addr = ""
        message.metadata["read_timestamp"] = timestamp
        message.save(update_fields=["delivered", "to_addr", "metadata"])

    outbound_event_total.labels(event_type, message.channel_id).inc()
    fire_delivery_hook(message)

    return (True, "Event processed")
129256
def delete_external_event(self, calendar_id, event_uid):
        
        self.request_handler.delete(endpoint='calendars/%s/events' % calendar_id, data={'event_uid': event_uid})
175867
def delete_event_matches(self, data=None):
        
        return self._post('event/%s/matches/delete_all' if data is None else 'event/%s/matches/delete', json.dumps(self.event_key) if data is None else json.dumps(data))
665342
def clear_reply_handlers_by_message_id(self, message_id):
        
        self.reply_handlers[message_id] = []

        if self.reply_saver is not None:
            self.reply_saver.start_save_timer()
1353460
def GetNewEventId(self, event_time=None):
    """"""
    if event_time is None:
      event_time = int(time.time() * 1e6)

    return "%s:%s:%s" % (event_time, socket.gethostname(), os.getpid())
1134701
def modify_event_view(request, id=None):
    
    event = get_object_or_404(Event, id=id)
    is_events_admin = request.user.has_admin_permission('events')

    if not is_events_admin:
        raise exceptions.PermissionDenied

    if request.method == "POST":
        if is_events_admin:
            form = AdminEventForm(data=request.POST, instance=event, all_groups=request.user.has_admin_permission('groups'))
        else:
            form = EventForm(data=request.POST, instance=event, all_groups=request.user.has_admin_permission('groups'))
        logger.debug(form)
        if form.is_valid():
            obj = form.save()
            # SAFE HTML
            obj.description = safe_html(obj.description)
            obj.save()
            messages.success(request, "Successfully modified event.")
            # return redirect("events")
        else:
            messages.error(request, "Error modifying event.")
    else:
        if is_events_admin:
            form = AdminEventForm(instance=event, all_groups=request.user.has_admin_permission('groups'))
        else:
            form = EventForm(instance=event, all_groups=request.user.has_admin_permission('groups'))
    context = {"form": form, "action": "modify", "action_title": "Modify", "id": id, "is_events_admin": is_events_admin}
    return render(request, "events/add_modify.html", context)
1250929
private boolean checkID(long id) {
    // Ensure that the given ID is a monotonically increasing ID.
    // If the ID is less than the last received ID then reset the
    // last received ID since the connection must have been reset.
    if (lastReceived == 0 || id == lastReceived + 1 || id < lastReceived) {
      lastReceived = id;
      // If the ID reaches the end of the current batch then tell the data
      // source that it's okay to remove all previous messages.
      if (lastReceived % BATCH_SIZE == 0) {
        ack();
      }
      return true;
    } else {
      fail();
    }
    return false;
  }
1184435
function EventHandlerError (status, info, id, msg){
        console.log ("#%d- Notice Info=%s Data=%s Id=%s Msg:%s", count, status, info, id, msg );
    }
434972
def on_message(self, message):
        
        log.debug("WS MSG for %s: %s" % (self._get_sess_id(), message))
        self.application.pc.redirect_incoming_message(self._get_sess_id(), message, self.request)
589238
def inplace_delete_message(
        message_queue: List[SendMessageEvent],
        state_change: Union[ReceiveDelivered, ReceiveProcessed],
) -> None:
    
    for message in list(message_queue):
        message_found = (
            message.message_identifier == state_change.message_identifier and
            message.recipient == state_change.sender
        )
        if message_found:
            message_queue.remove(message)
828225
def with_id(event_ids)
      Specification.new(reader, result.dup{ |r| r.with_ids = event_ids })
    end
1034069
function(redaction_event) {
        // quick sanity-check
        if (!redaction_event.event) {
            throw new Error("invalid redaction_event in makeRedacted");
        }

        // we attempt to replicate what we would see from the server if
        // the event had been redacted before we saw it.
        //
        // The server removes (most of) the content of the event, and adds a
        // "redacted_because" key to the unsigned section containing the
        // redacted event.
        if (!this.event.unsigned) {
            this.event.unsigned = {};
        }
        this.event.unsigned.redacted_because = redaction_event.event;

        let key;
        for (key in this.event) {
            if (!this.event.hasOwnProperty(key)) {
                continue;
            }
            if (!_REDACT_KEEP_KEY_MAP[key]) {
                delete this.event[key];
            }
        }

        const keeps = _REDACT_KEEP_CONTENT_MAP[this.getType()] || {};
        const content = this.getContent();
        for (key in content) {
            if (!content.hasOwnProperty(key)) {
                continue;
            }
            if (!keeps[key]) {
                delete content[key];
            }
        }
    }
294625
function (eventId) {
      var i;
      for (i = 0; i < this._events.length; i++) {
         var evt = this._events[i];
         if (evt.eventId === eventId) {
            return evt;
         }
      }
      return false;
   }