xmpp crate now supports ServerConnector
This commit is contained in:
parent
733d005f51
commit
38bfba4a18
20 changed files with 115 additions and 54 deletions
|
|
@ -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::{message::Message, muc::user::MucUser},
|
||||
Jid,
|
||||
|
|
@ -11,8 +12,8 @@ use tokio_xmpp::{
|
|||
|
||||
use crate::{delay::StanzaTimeInfo, Agent, Event};
|
||||
|
||||
pub async fn handle_message_chat(
|
||||
agent: &mut Agent,
|
||||
pub async fn handle_message_chat<C: ServerConnector>(
|
||||
agent: &mut Agent<C>,
|
||||
events: &mut Vec<Event>,
|
||||
from: Jid,
|
||||
message: &Message,
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@
|
|||
// 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::message::Message, Jid};
|
||||
|
||||
use crate::{delay::StanzaTimeInfo, Agent, Event};
|
||||
|
||||
pub async fn handle_message_group_chat(
|
||||
agent: &mut Agent,
|
||||
pub async fn handle_message_group_chat<C: ServerConnector>(
|
||||
agent: &mut Agent<C>,
|
||||
events: &mut Vec<Event>,
|
||||
from: Jid,
|
||||
message: &Message,
|
||||
|
|
|
|||
|
|
@ -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::{
|
||||
message::{Message, MessageType},
|
||||
ns,
|
||||
|
|
@ -14,7 +15,10 @@ use crate::{delay::message_time_info, pubsub, Agent, Event};
|
|||
pub mod chat;
|
||||
pub mod group_chat;
|
||||
|
||||
pub async fn handle_message(agent: &mut Agent, message: Message) -> Vec<Event> {
|
||||
pub async fn handle_message<C: ServerConnector>(
|
||||
agent: &mut Agent<C>,
|
||||
message: Message,
|
||||
) -> Vec<Event> {
|
||||
let mut events = vec![];
|
||||
let from = message.from.clone().unwrap();
|
||||
let time_info = message_time_info(&message);
|
||||
|
|
|
|||
|
|
@ -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::message::{Body, Message, MessageType},
|
||||
Jid,
|
||||
|
|
@ -11,8 +12,8 @@ use tokio_xmpp::{
|
|||
|
||||
use crate::Agent;
|
||||
|
||||
pub async fn send_message(
|
||||
agent: &mut Agent,
|
||||
pub async fn send_message<C: ServerConnector>(
|
||||
agent: &mut Agent<C>,
|
||||
recipient: Jid,
|
||||
type_: MessageType,
|
||||
lang: &str,
|
||||
|
|
|
|||
Loading…
Reference in a new issue