class

XMPP::MessageCorrection

Inherits Reference / Object

MessageCorrection is a high-level client for XEP-0308 - Last Message Correction.

A corrected chat message replaces an earlier one by referencing its id. Receivers with support treat the new body as authoritative.

corrector = XMPP::MessageCorrection.new(client) corrector.correct(to: "juliet@capulet.lit", original_id: id, body: "My pardon")

Incoming corrections are handled like any other message:

client.on("message") do |s, m| if replace = m.as(XMPP::Stanza::Message).get(XMPP::Stanza::Replace) replace.id # the id of the message being corrected end end

See: https://xmpp.org/extensions/xep-0308.html

Constructors

new(client : Client)
Source

Instance methods

correct(to : String, original_id : String, body : String, type : String = "chat")

correct sends a corrected message whose body supersedes the message identified by original_id.

Source
corrected?(message : Stanza::Message) : String | Nil

corrected? returns the id of the message this message corrects, or nil when it is not a correction.

Source