class
XMPP::MessageCorrection
- XMPP::MessageCorrection
- Reference
- Object
Overview
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: "[email protected]", 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
Defined in:
xmpp/message_correction.crConstructors
Instance Method Summary
-
#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.
-
#corrected?(message : Stanza::Message) : String | Nil
corrected? returns the id of the message this message corrects, or nil when it is not a correction.
Constructor Detail
Instance Method Detail
correct sends a corrected message whose body supersedes the message identified by original_id.
corrected? returns the id of the message this message corrects, or nil when it is not a correction.