xmpp crate now supports ServerConnector

This commit is contained in:
moparisthebest 2023-12-31 01:17:29 -05:00
commit 38bfba4a18
No known key found for this signature in database
GPG key ID: 88C93BFE27BC8229
20 changed files with 115 additions and 54 deletions

View file

@ -5,6 +5,7 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use futures::StreamExt;
use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{
parsers::{
disco::DiscoInfoQuery, iq::Iq, message::Message, presence::Presence, roster::Roster,
@ -20,7 +21,7 @@ use crate::{iq, message, presence, Agent, Event};
///
/// - `Some(events)` if there are new events; multiple may be returned at once.
/// - `None` if the underlying stream is closed.
pub async fn wait_for_events(agent: &mut Agent) -> Option<Vec<Event>> {
pub async fn wait_for_events<C: ServerConnector>(agent: &mut Agent<C>) -> Option<Vec<Event>> {
if let Some(event) = agent.client.next().await {
let mut events = Vec::new();