Add StanzaTimeInfo for <delay> (XEP-0203)

This commit is contained in:
xmppftw xmppftw 2023-12-31 21:06:15 +01:00
commit 3d9bdd6fe2
8 changed files with 114 additions and 18 deletions

View file

@ -6,7 +6,7 @@
use tokio_xmpp::parsers::{bookmarks2, message::Body, roster::Item as RosterItem, BareJid, Jid};
use crate::{Error, Id, RoomNick};
use crate::{delay::StanzaTimeInfo, Error, Id, RoomNick};
#[derive(Debug)]
pub enum Event {
@ -17,21 +17,26 @@ pub enum Event {
ContactChanged(RosterItem),
#[cfg(feature = "avatars")]
AvatarRetrieved(Jid, String),
ChatMessage(Id, BareJid, Body),
/// A chat message was received. It may have been delayed on the network.
/// - The [`Id`] is a unique identifier for this message.
/// - The [`BareJid`] is the sender's JID.
/// - The [`Body`] is the message body.
/// - The [`StanzaTimeInfo`] about when message was received, and when the message was claimed sent.
ChatMessage(Id, BareJid, Body, StanzaTimeInfo),
JoinRoom(BareJid, bookmarks2::Conference),
LeaveRoom(BareJid),
LeaveAllRooms,
RoomJoined(BareJid),
RoomLeft(BareJid),
RoomMessage(Id, BareJid, RoomNick, Body),
RoomMessage(Id, BareJid, RoomNick, Body, StanzaTimeInfo),
/// The subject of a room was received.
/// - The BareJid is the room's address.
/// - The RoomNick is the nickname of the room member who set the subject.
/// - The String is the new subject.
RoomSubject(BareJid, Option<RoomNick>, String),
RoomSubject(BareJid, Option<RoomNick>, String, StanzaTimeInfo),
/// A private message received from a room, containing the message ID, the room's BareJid,
/// the sender's nickname, and the message body.
RoomPrivateMessage(Id, BareJid, RoomNick, Body),
ServiceMessage(Id, BareJid, Body),
RoomPrivateMessage(Id, BareJid, RoomNick, Body, StanzaTimeInfo),
ServiceMessage(Id, BareJid, Body, StanzaTimeInfo),
HttpUploadedFile(String),
}