xmpp: Use tokio-xmpp’s reexports of jid and minidom

This commit is contained in:
Emmanuel Gil Peyrot 2024-07-24 20:52:10 +02:00 • committed by Jonas Schäfer
commit 5fc12c45b5
19 changed files with 35 additions and 21 deletions

View file

@ -6,7 +6,8 @@
use std::env::args; use std::env::args;
use std::str::FromStr; 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}; use xmpp::{ClientBuilder, ClientFeature, ClientType, Event};
#[tokio::main] #[tokio::main]

View file

@ -9,7 +9,11 @@ use std::sync::{Arc, RwLock};
use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::connect::ServerConnector;
pub use tokio_xmpp::parsers; pub use tokio_xmpp::parsers;
use tokio_xmpp::parsers::{disco::DiscoInfoResult, message::MessageType}; 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}; use crate::{event_loop, message, muc, upload, Error, Event, RoomNick};

View file

@ -7,11 +7,12 @@
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{ use tokio_xmpp::{
jid::{BareJid, Jid},
parsers::{ parsers::{
disco::{DiscoInfoResult, Feature, Identity}, disco::{DiscoInfoResult, Feature, Identity},
ns, ns,
}, },
AsyncClient as TokioXmppClient, AsyncConfig, BareJid, Jid, AsyncClient as TokioXmppClient, AsyncConfig,
}; };
use crate::{Agent, ClientFeature}; use crate::{Agent, ClientFeature};

View file

@ -6,8 +6,8 @@
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use tokio_xmpp::{ use tokio_xmpp::{
jid::Jid,
parsers::{delay::Delay, message::Message, ns}, parsers::{delay::Delay, message::Message, ns},
Jid,
}; };
/// Time information associated with a stanza. /// Time information associated with a stanza.

View file

@ -6,6 +6,7 @@
use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{ use tokio_xmpp::{
jid::Jid,
parsers::{ parsers::{
bookmarks, bookmarks,
disco::DiscoInfoResult, disco::DiscoInfoResult,
@ -14,7 +15,6 @@ use tokio_xmpp::{
private::Query as PrivateXMLQuery, private::Query as PrivateXMLQuery,
pubsub::pubsub::{Items, PubSub}, pubsub::pubsub::{Items, PubSub},
}, },
Jid,
}; };
use crate::Agent; use crate::Agent;

View file

@ -4,9 +4,10 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
use tokio_xmpp::jid::BareJid;
#[cfg(feature = "avatars")] #[cfg(feature = "avatars")]
use tokio_xmpp::parsers::Jid; use tokio_xmpp::jid::Jid;
use tokio_xmpp::parsers::{bookmarks2, message::Body, roster::Item as RosterItem, BareJid}; use tokio_xmpp::parsers::{bookmarks2, message::Body, roster::Item as RosterItem};
use crate::{delay::StanzaTimeInfo, Error, Id, RoomNick}; use crate::{delay::StanzaTimeInfo, Error, Id, RoomNick};

View file

@ -6,13 +6,14 @@
use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{ use tokio_xmpp::{
jid::Jid,
minidom::Element,
parsers::{ parsers::{
disco::DiscoInfoQuery, disco::DiscoInfoQuery,
iq::Iq, iq::Iq,
ns, ns,
stanza_error::{DefinedCondition, ErrorType, StanzaError}, stanza_error::{DefinedCondition, ErrorType, StanzaError},
}, },
Element, Jid,
}; };
use crate::{Agent, Event}; use crate::{Agent, Event};

View file

@ -6,8 +6,9 @@
use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{ use tokio_xmpp::{
jid::Jid,
minidom::Element,
parsers::{disco::DiscoInfoResult, ns, private::Query as PrivateXMLQuery, roster::Roster}, parsers::{disco::DiscoInfoResult, ns, private::Query as PrivateXMLQuery, roster::Roster},
Element, Jid,
}; };
use crate::{disco, pubsub, upload, Agent, Event}; use crate::{disco, pubsub, upload, Agent, Event};

View file

@ -6,11 +6,12 @@
use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{ use tokio_xmpp::{
jid::Jid,
minidom::Element,
parsers::{ parsers::{
iq::Iq, iq::Iq,
stanza_error::{DefinedCondition, ErrorType, StanzaError}, stanza_error::{DefinedCondition, ErrorType, StanzaError},
}, },
Element, Jid,
}; };
use crate::{Agent, Event}; use crate::{Agent, Event};

View file

@ -6,8 +6,9 @@
#![deny(bare_trait_objects)] #![deny(bare_trait_objects)]
pub use tokio_xmpp::jid;
pub use tokio_xmpp::minidom;
pub use tokio_xmpp::parsers; pub use tokio_xmpp::parsers;
pub use tokio_xmpp::{BareJid, Element, FullJid, Jid};
#[macro_use] #[macro_use]
extern crate log; extern crate log;
@ -37,7 +38,8 @@ pub type RoomNick = String;
#[cfg(all(test, any(feature = "starttls-rust", feature = "starttls-native")))] #[cfg(all(test, any(feature = "starttls-rust", feature = "starttls-native")))]
mod tests { mod tests {
use super::{BareJid, ClientBuilder, ClientFeature, ClientType, Event}; use super::jid::BareJid;
use super::{ClientBuilder, ClientFeature, ClientType, Event};
use std::str::FromStr; use std::str::FromStr;
use tokio_xmpp::AsyncClient as TokioXmppClient; use tokio_xmpp::AsyncClient as TokioXmppClient;

View file

@ -6,8 +6,8 @@
use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{ use tokio_xmpp::{
jid::Jid,
parsers::{message::Message, muc::user::MucUser}, parsers::{message::Message, muc::user::MucUser},
Jid,
}; };
use crate::{delay::StanzaTimeInfo, Agent, Event}; use crate::{delay::StanzaTimeInfo, Agent, Event};

View file

@ -5,7 +5,7 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
use tokio_xmpp::connect::ServerConnector; 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}; use crate::{delay::StanzaTimeInfo, Agent, Event};

View file

@ -6,8 +6,8 @@
use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{ use tokio_xmpp::{
jid::Jid,
parsers::message::{Body, Message, MessageType}, parsers::message::{Body, Message, MessageType},
Jid,
}; };
use crate::Agent; use crate::Agent;

View file

@ -6,11 +6,11 @@
use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{ use tokio_xmpp::{
jid::{BareJid, Jid},
parsers::{ parsers::{
message::{Body, Message, MessageType}, message::{Body, Message, MessageType},
muc::user::MucUser, muc::user::MucUser,
}, },
BareJid, Jid,
}; };
use crate::{Agent, RoomNick}; use crate::{Agent, RoomNick};

View file

@ -6,11 +6,11 @@
use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{ use tokio_xmpp::{
jid::BareJid,
parsers::{ parsers::{
muc::Muc, muc::Muc,
presence::{Presence, Type as PresenceType}, presence::{Presence, Type as PresenceType},
}, },
BareJid,
}; };
use crate::{Agent, RoomNick}; use crate::{Agent, RoomNick};

View file

@ -12,13 +12,13 @@ use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::parsers::{ use tokio_xmpp::parsers::{
avatar::{Data, Metadata}, avatar::{Data, Metadata},
iq::Iq, iq::Iq,
jid::Jid,
ns, ns,
pubsub::{ pubsub::{
event::Item, event::Item,
pubsub::{Items, PubSub}, pubsub::{Items, PubSub},
NodeName, NodeName,
}, },
Jid,
}; };
pub(crate) async fn handle_metadata_pubsub_event<C: ServerConnector>( pub(crate) async fn handle_metadata_pubsub_event<C: ServerConnector>(

View file

@ -9,12 +9,13 @@ use crate::Event;
use std::str::FromStr; use std::str::FromStr;
use tokio_xmpp::{ use tokio_xmpp::{
connect::ServerConnector, connect::ServerConnector,
jid::{BareJid, Jid},
minidom::Element,
parsers::{ parsers::{
bookmarks2::{self, Autojoin}, bookmarks2::{self, Autojoin},
ns, ns,
pubsub::event::PubSubEvent, pubsub::event::PubSubEvent,
pubsub::pubsub::PubSub, pubsub::pubsub::PubSub,
BareJid, Element, Jid,
}, },
}; };

View file

@ -12,8 +12,9 @@ use tokio::fs::File;
use tokio_util::codec::{BytesCodec, FramedRead}; use tokio_util::codec::{BytesCodec, FramedRead};
use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{ use tokio_xmpp::{
jid::Jid,
minidom::Element,
parsers::http_upload::{Header as HttpUploadHeader, SlotResult}, parsers::http_upload::{Header as HttpUploadHeader, SlotResult},
Element, Jid,
}; };
use crate::{Agent, Event}; use crate::{Agent, Event};

View file

@ -8,8 +8,8 @@ use std::path::Path;
use tokio::fs::File; use tokio::fs::File;
use tokio_xmpp::connect::ServerConnector; use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{ use tokio_xmpp::{
jid::Jid,
parsers::{http_upload::SlotRequest, iq::Iq}, parsers::{http_upload::SlotRequest, iq::Iq},
Jid,
}; };
use crate::Agent; use crate::Agent;