Enum Event

Source
pub enum Event {
Show 17 variants Online, Disconnected(Error), ContactAdded(Item), ContactRemoved(Item), ContactChanged(Item), AvatarRetrieved(Jid, String), ChatMessage(Option<Id>, BareJid, String, StanzaTimeInfo), ChatMessageCorrection(Id, BareJid, String, StanzaTimeInfo), RoomJoined(BareJid), RoomLeft(BareJid), RoomMessage(Option<Id>, BareJid, RoomNick, String, StanzaTimeInfo), RoomMessageCorrection(Id, BareJid, RoomNick, String, StanzaTimeInfo), RoomSubject(BareJid, Option<RoomNick>, String, StanzaTimeInfo), RoomPrivateMessage(Option<Id>, BareJid, RoomNick, String, StanzaTimeInfo), RoomPrivateMessageCorrection(Id, BareJid, RoomNick, String, StanzaTimeInfo), ServiceMessage(Option<Id>, BareJid, String, StanzaTimeInfo), HttpUploadedFile(String),
}
Expand description

An Event notifying the client something has happened that may require attention.

This can be an XMPP event received from the server, or existing state communicated by the server to the client, like when receiving the contact list.

Variants§

§

Online

Client connected.

§

Disconnected(Error)

Client disconnected; if reconnect is disabled, no more event will be received.

§

ContactAdded(Item)

Contact received from contact list (roster).

This happens when:

  • it was added recently to the contact list
  • or when the client just came online and is receiving the existing contact list
§

ContactRemoved(Item)

Contact removed from contact list (roster).

§

ContactChanged(Item)

Contact changed in contact list (roster).

This happens when (non-exhaustive):

  • the contact’s nickname changed
  • the contact’s subscription status changed (eg. they accepted a friend request)
  • the contact has been added to or removed from a contact group
§

AvatarRetrieved(Jid, String)

Available on crate feature avatars only.

Avatar received for a certain JID, with sender JID / avatar path

The avatar path is relative file path to the avatar data.

NOTE: For now, it’s not possible to configure where the avatars are stored, see issue 112 for more information.

§

ChatMessage(Option<Id>, BareJid, String, StanzaTimeInfo)

A chat message was received. It may have been delayed on the network.

  • The MessageId is a unique identifier for this message.
  • The BareJid is the sender’s JID.
  • The String is the message body.
  • The StanzaTimeInfo about when message was received, and when the message was claimed sent.
§

ChatMessageCorrection(Id, BareJid, String, StanzaTimeInfo)

A message in a one-to-one chat was corrected/edited.

  • The MessageId is the ID of the message that was corrected.
  • The BareJid is the JID of the other participant in the chat.
  • The String is the new body of the message, to replace the old one.
  • The StanzaTimeInfo is the time the message correction was sent/received
§

RoomJoined(BareJid)

Room joined; client may receive and send messages from/to this BareJid.

§

RoomLeft(BareJid)

Room left; client may not receive and send messages from/to this BareJid

§

RoomMessage(Option<Id>, BareJid, RoomNick, String, StanzaTimeInfo)

Room message received with:

  • An optional MessageId for the message.
  • The BareJid of the room the message was sent from.
  • The RoomNick of the sender.
  • A String containing the actual message.
  • The StanzaTimeInfo containing time related information for the message.
§

RoomMessageCorrection(Id, BareJid, RoomNick, String, StanzaTimeInfo)

A message in a MUC was corrected/edited.

  • The MessageId is the ID of the message that was corrected.
  • The BareJid is the JID of the room where the message was sent.
  • The RoomNick is the nickname of the sender of the message.
  • The String is the new body of the message, to replace the old one.
  • The StanzaTimeInfo is the time the message correction was sent/received
§

RoomSubject(BareJid, Option<RoomNick>, String, 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.
§

RoomPrivateMessage(Option<Id>, BareJid, RoomNick, String, StanzaTimeInfo)

A private message received from a room, containing:

§

RoomPrivateMessageCorrection(Id, BareJid, RoomNick, String, StanzaTimeInfo)

A private message in a MUC was corrected/edited.

  • The MessageId is the ID of the message that was corrected.
  • The BareJid is the JID of the room where the message was sent.
  • The RoomNick is the nickname of the sender of the message.
  • The String is the new body of the message, to replace the old one.
  • The StanzaTimeInfo is the time the message correction was sent/received
§

ServiceMessage(Option<Id>, BareJid, String, StanzaTimeInfo)

Service message (eg. server notification) received, with:

  • An optional MessageId for the message.
  • The BareJid of the entity that sent it.
  • A String containing the actual message.
  • The StanzaTimeInfo containing time related information for the message.
§

HttpUploadedFile(String)

A file has been uploaded over HTTP; contains the URL of the file.

Trait Implementations§

Source§

impl Debug for Event

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Event

§

impl !RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl !UnwindSafe for Event

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,