From 5fc12c45b5d822734a6dbd1143afb880ea4ee418 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 24 Jul 2024 20:52:10 +0200 Subject: [PATCH] =?UTF-8?q?xmpp:=20Use=20tokio-xmpp=E2=80=99s=20reexports?= =?UTF-8?q?=20of=20jid=20and=20minidom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xmpp/examples/hello_bot.rs | 3 ++- xmpp/src/agent.rs | 6 +++++- xmpp/src/builder.rs | 3 ++- xmpp/src/delay.rs | 2 +- xmpp/src/disco/mod.rs | 2 +- xmpp/src/event.rs | 5 +++-- xmpp/src/iq/get.rs | 3 ++- xmpp/src/iq/result.rs | 3 ++- xmpp/src/iq/set.rs | 3 ++- xmpp/src/lib.rs | 6 ++++-- xmpp/src/message/receive/chat.rs | 2 +- xmpp/src/message/receive/group_chat.rs | 2 +- xmpp/src/message/send.rs | 2 +- xmpp/src/muc/private_message.rs | 2 +- xmpp/src/muc/room.rs | 2 +- xmpp/src/pubsub/avatar.rs | 2 +- xmpp/src/pubsub/mod.rs | 3 ++- xmpp/src/upload/receive.rs | 3 ++- xmpp/src/upload/send.rs | 2 +- 19 files changed, 35 insertions(+), 21 deletions(-) diff --git a/xmpp/examples/hello_bot.rs b/xmpp/examples/hello_bot.rs index a78d4905..bd12fa37 100644 --- a/xmpp/examples/hello_bot.rs +++ b/xmpp/examples/hello_bot.rs @@ -6,7 +6,8 @@ use std::env::args; use std::str::FromStr; -use tokio_xmpp::parsers::{message::MessageType, BareJid, Jid}; +use tokio_xmpp::jid::{BareJid, Jid}; +use tokio_xmpp::parsers::message::MessageType; use xmpp::{ClientBuilder, ClientFeature, ClientType, Event}; #[tokio::main] diff --git a/xmpp/src/agent.rs b/xmpp/src/agent.rs index df31db7a..48d39cf3 100644 --- a/xmpp/src/agent.rs +++ b/xmpp/src/agent.rs @@ -9,7 +9,11 @@ use std::sync::{Arc, RwLock}; use tokio_xmpp::connect::ServerConnector; pub use tokio_xmpp::parsers; use tokio_xmpp::parsers::{disco::DiscoInfoResult, message::MessageType}; -pub use tokio_xmpp::{AsyncClient as TokioXmppClient, BareJid, Element, FullJid, Jid}; +pub use tokio_xmpp::{ + jid::{BareJid, FullJid, Jid}, + minidom::Element, + AsyncClient as TokioXmppClient, +}; use crate::{event_loop, message, muc, upload, Error, Event, RoomNick}; diff --git a/xmpp/src/builder.rs b/xmpp/src/builder.rs index d416a127..73ceaab9 100644 --- a/xmpp/src/builder.rs +++ b/xmpp/src/builder.rs @@ -7,11 +7,12 @@ use std::sync::{Arc, RwLock}; use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::{ + jid::{BareJid, Jid}, parsers::{ disco::{DiscoInfoResult, Feature, Identity}, ns, }, - AsyncClient as TokioXmppClient, AsyncConfig, BareJid, Jid, + AsyncClient as TokioXmppClient, AsyncConfig, }; use crate::{Agent, ClientFeature}; diff --git a/xmpp/src/delay.rs b/xmpp/src/delay.rs index b45ea91c..24982fe1 100644 --- a/xmpp/src/delay.rs +++ b/xmpp/src/delay.rs @@ -6,8 +6,8 @@ use chrono::{DateTime, Utc}; use tokio_xmpp::{ + jid::Jid, parsers::{delay::Delay, message::Message, ns}, - Jid, }; /// Time information associated with a stanza. diff --git a/xmpp/src/disco/mod.rs b/xmpp/src/disco/mod.rs index 3c76498a..ee3312e3 100644 --- a/xmpp/src/disco/mod.rs +++ b/xmpp/src/disco/mod.rs @@ -6,6 +6,7 @@ use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::{ + jid::Jid, parsers::{ bookmarks, disco::DiscoInfoResult, @@ -14,7 +15,6 @@ use tokio_xmpp::{ private::Query as PrivateXMLQuery, pubsub::pubsub::{Items, PubSub}, }, - Jid, }; use crate::Agent; diff --git a/xmpp/src/event.rs b/xmpp/src/event.rs index c7a8e3a2..65d66e5a 100644 --- a/xmpp/src/event.rs +++ b/xmpp/src/event.rs @@ -4,9 +4,10 @@ // 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/. +use tokio_xmpp::jid::BareJid; #[cfg(feature = "avatars")] -use tokio_xmpp::parsers::Jid; -use tokio_xmpp::parsers::{bookmarks2, message::Body, roster::Item as RosterItem, BareJid}; +use tokio_xmpp::jid::Jid; +use tokio_xmpp::parsers::{bookmarks2, message::Body, roster::Item as RosterItem}; use crate::{delay::StanzaTimeInfo, Error, Id, RoomNick}; diff --git a/xmpp/src/iq/get.rs b/xmpp/src/iq/get.rs index f64a950f..cb9fb708 100644 --- a/xmpp/src/iq/get.rs +++ b/xmpp/src/iq/get.rs @@ -6,13 +6,14 @@ use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::{ + jid::Jid, + minidom::Element, parsers::{ disco::DiscoInfoQuery, iq::Iq, ns, stanza_error::{DefinedCondition, ErrorType, StanzaError}, }, - Element, Jid, }; use crate::{Agent, Event}; diff --git a/xmpp/src/iq/result.rs b/xmpp/src/iq/result.rs index 26d2ce51..70eea320 100644 --- a/xmpp/src/iq/result.rs +++ b/xmpp/src/iq/result.rs @@ -6,8 +6,9 @@ use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::{ + jid::Jid, + minidom::Element, parsers::{disco::DiscoInfoResult, ns, private::Query as PrivateXMLQuery, roster::Roster}, - Element, Jid, }; use crate::{disco, pubsub, upload, Agent, Event}; diff --git a/xmpp/src/iq/set.rs b/xmpp/src/iq/set.rs index 4793d8d4..821b45ee 100644 --- a/xmpp/src/iq/set.rs +++ b/xmpp/src/iq/set.rs @@ -6,11 +6,12 @@ use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::{ + jid::Jid, + minidom::Element, parsers::{ iq::Iq, stanza_error::{DefinedCondition, ErrorType, StanzaError}, }, - Element, Jid, }; use crate::{Agent, Event}; diff --git a/xmpp/src/lib.rs b/xmpp/src/lib.rs index 780fe4eb..cff66128 100644 --- a/xmpp/src/lib.rs +++ b/xmpp/src/lib.rs @@ -6,8 +6,9 @@ #![deny(bare_trait_objects)] +pub use tokio_xmpp::jid; +pub use tokio_xmpp::minidom; pub use tokio_xmpp::parsers; -pub use tokio_xmpp::{BareJid, Element, FullJid, Jid}; #[macro_use] extern crate log; @@ -37,7 +38,8 @@ pub type RoomNick = String; #[cfg(all(test, any(feature = "starttls-rust", feature = "starttls-native")))] mod tests { - use super::{BareJid, ClientBuilder, ClientFeature, ClientType, Event}; + use super::jid::BareJid; + use super::{ClientBuilder, ClientFeature, ClientType, Event}; use std::str::FromStr; use tokio_xmpp::AsyncClient as TokioXmppClient; diff --git a/xmpp/src/message/receive/chat.rs b/xmpp/src/message/receive/chat.rs index e81f9a1f..da708a1d 100644 --- a/xmpp/src/message/receive/chat.rs +++ b/xmpp/src/message/receive/chat.rs @@ -6,8 +6,8 @@ use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::{ + jid::Jid, parsers::{message::Message, muc::user::MucUser}, - Jid, }; use crate::{delay::StanzaTimeInfo, Agent, Event}; diff --git a/xmpp/src/message/receive/group_chat.rs b/xmpp/src/message/receive/group_chat.rs index 2e5c9087..66dfb8f7 100644 --- a/xmpp/src/message/receive/group_chat.rs +++ b/xmpp/src/message/receive/group_chat.rs @@ -5,7 +5,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. use tokio_xmpp::connect::ServerConnector; -use tokio_xmpp::{parsers::message::Message, Jid}; +use tokio_xmpp::{jid::Jid, parsers::message::Message}; use crate::{delay::StanzaTimeInfo, Agent, Event}; diff --git a/xmpp/src/message/send.rs b/xmpp/src/message/send.rs index 877aca82..d099d2b0 100644 --- a/xmpp/src/message/send.rs +++ b/xmpp/src/message/send.rs @@ -6,8 +6,8 @@ use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::{ + jid::Jid, parsers::message::{Body, Message, MessageType}, - Jid, }; use crate::Agent; diff --git a/xmpp/src/muc/private_message.rs b/xmpp/src/muc/private_message.rs index 7b5883ff..dc1ca7bb 100644 --- a/xmpp/src/muc/private_message.rs +++ b/xmpp/src/muc/private_message.rs @@ -6,11 +6,11 @@ use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::{ + jid::{BareJid, Jid}, parsers::{ message::{Body, Message, MessageType}, muc::user::MucUser, }, - BareJid, Jid, }; use crate::{Agent, RoomNick}; diff --git a/xmpp/src/muc/room.rs b/xmpp/src/muc/room.rs index 17d73d18..96f62893 100644 --- a/xmpp/src/muc/room.rs +++ b/xmpp/src/muc/room.rs @@ -6,11 +6,11 @@ use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::{ + jid::BareJid, parsers::{ muc::Muc, presence::{Presence, Type as PresenceType}, }, - BareJid, }; use crate::{Agent, RoomNick}; diff --git a/xmpp/src/pubsub/avatar.rs b/xmpp/src/pubsub/avatar.rs index 83728ad0..3d522b59 100644 --- a/xmpp/src/pubsub/avatar.rs +++ b/xmpp/src/pubsub/avatar.rs @@ -12,13 +12,13 @@ use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::parsers::{ avatar::{Data, Metadata}, iq::Iq, + jid::Jid, ns, pubsub::{ event::Item, pubsub::{Items, PubSub}, NodeName, }, - Jid, }; pub(crate) async fn handle_metadata_pubsub_event( diff --git a/xmpp/src/pubsub/mod.rs b/xmpp/src/pubsub/mod.rs index 921966dd..08702268 100644 --- a/xmpp/src/pubsub/mod.rs +++ b/xmpp/src/pubsub/mod.rs @@ -9,12 +9,13 @@ use crate::Event; use std::str::FromStr; use tokio_xmpp::{ connect::ServerConnector, + jid::{BareJid, Jid}, + minidom::Element, parsers::{ bookmarks2::{self, Autojoin}, ns, pubsub::event::PubSubEvent, pubsub::pubsub::PubSub, - BareJid, Element, Jid, }, }; diff --git a/xmpp/src/upload/receive.rs b/xmpp/src/upload/receive.rs index ff6ef557..9f2c712c 100644 --- a/xmpp/src/upload/receive.rs +++ b/xmpp/src/upload/receive.rs @@ -12,8 +12,9 @@ use tokio::fs::File; use tokio_util::codec::{BytesCodec, FramedRead}; use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::{ + jid::Jid, + minidom::Element, parsers::http_upload::{Header as HttpUploadHeader, SlotResult}, - Element, Jid, }; use crate::{Agent, Event}; diff --git a/xmpp/src/upload/send.rs b/xmpp/src/upload/send.rs index 54edc90f..c00e098c 100644 --- a/xmpp/src/upload/send.rs +++ b/xmpp/src/upload/send.rs @@ -8,8 +8,8 @@ use std::path::Path; use tokio::fs::File; use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::{ + jid::Jid, parsers::{http_upload::SlotRequest, iq::Iq}, - Jid, }; use crate::Agent;