From 7b63e241689b20d49a73f71b37612ef3aa393d5e Mon Sep 17 00:00:00 2001 From: xmppftw Date: Wed, 7 Aug 2024 10:47:12 +0200 Subject: [PATCH] Update to xmpp 0.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- Cargo.toml | 4 ++-- src/bot.rs | 10 ++++++---- src/config.rs | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 319d394..2e1b247 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,14 +14,14 @@ hyper = { version = "1.4", default-features = false, features = [ "http1", "serv hyper-util = { version = "0.1", features = [ "tokio" ] } http-body-util = "0.1" bytes = "1.6" -jid = { version = "0.10", features = [ "serde" ] } log = "0.4" tokio = { version = "1", default-features = false, features = [ "rt", "net", "sync", "fs" ] } +tokio-xmpp = { version = "4.0.0", default-features = false } pretty_env_logger = "0.5" serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" toml = "0.8" -xmpp = "0.5" +xmpp = { version = "0.6", default-features = false, features = [ "serde", "starttls-native"] } hmac = "0.12" sha2 = "0.10" hex = "0.4" diff --git a/src/bot.rs b/src/bot.rs index 2e86961..6dfb09c 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -16,12 +16,14 @@ use crate::hook::{format_hook, GitlabHook}; use log::debug; +use tokio_xmpp::starttls::ServerConfig; +use xmpp::jid::{BareJid, Jid}; use xmpp::parsers::message::MessageType; -use xmpp::{Agent, BareJid, ClientBuilder, ClientFeature, ClientType, Event, Jid}; +use xmpp::{Agent, ClientBuilder, ClientFeature, ClientType, Event}; pub struct XmppClient { is_online: bool, - agent: Agent, + agent: Agent, rooms: Vec, nickname: String, } @@ -63,9 +65,9 @@ impl XmppClient { .await } } - Event::Disconnected => { + Event::Disconnected(e) => { self.is_online = false; - debug!("XMPP Disconnected"); + debug!("XMPP Disconnected: {e}"); } _ => { debug!("XMPP Event not supported") diff --git a/src/config.rs b/src/config.rs index 4ef257e..091389d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -17,9 +17,9 @@ use std::io::{Error as IoError, ErrorKind as IoErrorKind}; use std::net::{IpAddr, Ipv6Addr, SocketAddr}; use camino::{Utf8Path, Utf8PathBuf}; -use jid::BareJid; use log::debug; use serde::{Deserialize, Serialize}; +use xmpp::jid::BareJid; use crate::error::Error;