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

@ -4,6 +4,7 @@
// 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::connect::ServerConnector;
use tokio_xmpp::{
parsers::{
disco::DiscoInfoQuery,
@ -16,8 +17,8 @@ use tokio_xmpp::{
use crate::{Agent, Event};
pub async fn handle_iq_get(
agent: &mut Agent,
pub async fn handle_iq_get<C: ServerConnector>(
agent: &mut Agent<C>,
_events: &mut Vec<Event>,
from: Jid,
_to: Option<Jid>,

View file

@ -4,6 +4,7 @@
// 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::connect::ServerConnector;
use tokio_xmpp::parsers::iq::{Iq, IqType};
use crate::{Agent, Event};
@ -12,7 +13,7 @@ pub mod get;
pub mod result;
pub mod set;
pub async fn handle_iq(agent: &mut Agent, iq: Iq) -> Vec<Event> {
pub async fn handle_iq<C: ServerConnector>(agent: &mut Agent<C>, iq: Iq) -> Vec<Event> {
let mut events = vec![];
let from = iq
.from

View file

@ -4,6 +4,7 @@
// 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::connect::ServerConnector;
use tokio_xmpp::{
parsers::{ns, private::Query as PrivateXMLQuery, roster::Roster},
Element, Jid,
@ -11,8 +12,8 @@ use tokio_xmpp::{
use crate::{disco, pubsub, upload, Agent, Event};
pub async fn handle_iq_result(
agent: &mut Agent,
pub async fn handle_iq_result<C: ServerConnector>(
agent: &mut Agent<C>,
events: &mut Vec<Event>,
from: Jid,
_to: Option<Jid>,

View file

@ -4,6 +4,7 @@
// 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::connect::ServerConnector;
use tokio_xmpp::{
parsers::{
iq::Iq,
@ -14,8 +15,8 @@ use tokio_xmpp::{
use crate::{Agent, Event};
pub async fn handle_iq_set(
agent: &mut Agent,
pub async fn handle_iq_set<C: ServerConnector>(
agent: &mut Agent<C>,
_events: &mut Vec<Event>,
from: Jid,
_to: Option<Jid>,