Compare commits

...

1 Commits

Author SHA1 Message Date
Maxime “pep” Buquet f963d9c0b3
WIP: Try using xmpp.send_message in another select! branch
Requires tokio-xmpp's xmpp-send-buffered-message branch (currently
bc0b1684e), available in the repo.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-07-28 17:55:42 +02:00
2 changed files with 6 additions and 11 deletions

View File

@ -13,6 +13,7 @@ dbus-tokio = "0.7.5"
tokio = { version = "1.19.2", features = [ "time", "macros", "rt-multi-thread" ] }
futures = "0.3"
futures-util = "0.3"
tokio-xmpp = "3.2"
xmpp = "0.3"
xmpp-parsers = "0.19"
log = "0.4"

View File

@ -26,7 +26,6 @@ use std::env::args;
use env_logger;
use futures_util::StreamExt;
use tokio::{
task::JoinHandle,
time::Duration,
@ -34,7 +33,7 @@ use tokio::{
use mmdbus::{
dbus::{
message::MatchRule,
// message::MatchRule,
nonblock::{
SyncConnection, Proxy,
stdintf::org_freedesktop_dbus::ObjectManager,
@ -211,13 +210,7 @@ pub async fn main() -> Result<(), Error> {
return Err(Error::InvalidArgs)
}
// ModemManager
let dbus = DBus::connect()?;
let mut interval = tokio::time::interval(Duration::from_secs(2));
let mr = MatchRule::new_signal("org.freedesktop.DBus.Properties", "PropertiesChanged");
let mut interval = tokio::time::interval(Duration::from_secs(5));
// XMPP
let jid_str = args[1].as_str();
@ -237,8 +230,9 @@ pub async fn main() -> Result<(), Error> {
println!("Events: {:?}", events);
},
_ = interval.tick() => {
let mm = ModemManager { dbus: dbus.clone() };
let _ = print_foo(mm).await;
println!("Foo1");
// Uncomment to have tokio-xmpp stall right after successful bind.
// xmpp.send_message(jid.clone(), MessageType::Chat, "en", "Bar").await;
},
}
}