mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-06-18 05:35:57 +02:00
73 lines
3.4 KiB
Rust
73 lines
3.4 KiB
Rust
// Copyright (c) 2023 xmpp-rs contributors.
|
|
//
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
#[cfg(feature = "avatars")]
|
|
use tokio_xmpp::parsers::Jid;
|
|
use tokio_xmpp::parsers::{bookmarks2, message::Body, roster::Item as RosterItem, BareJid};
|
|
|
|
use crate::message::MucMessageId;
|
|
use crate::{delay::StanzaTimeInfo, Error, Id, RoomNick};
|
|
|
|
#[derive(Debug)]
|
|
pub enum Event {
|
|
Online,
|
|
Disconnected(Error),
|
|
ContactAdded(RosterItem),
|
|
ContactRemoved(RosterItem),
|
|
ContactChanged(RosterItem),
|
|
#[cfg(feature = "avatars")]
|
|
AvatarRetrieved(Jid, String),
|
|
/// 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),
|
|
/// A message received from a group chat room.
|
|
/// - The [`MucMessageId`] is the ID of the message; it contains the ID assigned by the room,
|
|
/// and the ID assigned by the sending client.
|
|
/// - The [`BareJid`] is the room's address.
|
|
/// - The [`RoomNick`] is the nickname of the room member who sent the message.
|
|
/// - The [`Body`] is the message body.
|
|
/// - The [`StanzaTimeInfo`] about when message was received, and when the message was claimed sent.
|
|
///
|
|
/// Note: if the sender_assigned_id matches the ID returned by Agent::send_message,
|
|
/// then the message is an echo of a message sent by the client.
|
|
RoomMessage(MucMessageId, BareJid, RoomNick, Body, StanzaTimeInfo),
|
|
/// The subject of a room was received.
|
|
/// - The MucMessageId is the ID of the message that contained the subject;
|
|
/// it contains the ID assigned by the room, and the ID assigned by the sending client.
|
|
/// - 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.
|
|
/// - The [`StanzaTimeInfo`] about when message was received, and when the message was claimed sent.
|
|
RoomSubject(
|
|
MucMessageId,
|
|
BareJid,
|
|
Option<RoomNick>,
|
|
String,
|
|
StanzaTimeInfo,
|
|
),
|
|
/// A private message received from a member of a room.
|
|
/// - The [`MucMessageId`] is the ID of the message; it contains the ID assigned by the room,
|
|
/// and the ID assigned by the sending client.
|
|
/// - The [`BareJid`] is the room's address.
|
|
/// - The [`RoomNick`] is the nickname of the room member who sent the message.
|
|
/// - The [`Body`] is the message body.
|
|
/// - The [`StanzaTimeInfo`] about when message was received, and when the message was claimed sent.
|
|
///
|
|
/// Note: if the sender_assigned_id matches the ID returned by Agent::send_room_private_message,
|
|
/// then the message is an echo of a message sent by the client.
|
|
RoomPrivateMessage(MucMessageId, BareJid, RoomNick, Body, StanzaTimeInfo),
|
|
ServiceMessage(Id, BareJid, Body, StanzaTimeInfo),
|
|
HttpUploadedFile(String),
|
|
}
|