heliwatch: update for newer tokio-xmpp, geo

This commit is contained in:
Astro 2023-09-22 19:45:10 +02:00
parent e419039481
commit d5e2527927
3 changed files with 6 additions and 6 deletions

View File

@ -75,7 +75,7 @@ impl State {
}
let pos = entry.position()?;
let coord = geo::Coordinate { x: pos.longitude, y: pos.latitude };
let coord = geo::Coord { x: pos.longitude, y: pos.latitude };
if let Some(old_pos) = self.position.replace(pos.clone()) {
if old_pos.longitude != pos.longitude || old_pos.latitude != pos.latitude {
let location = locations.find(&coord);

View File

@ -28,11 +28,11 @@ pub async fn run(jid: String, password: String, muc_jid: String) -> Handle {
};
let (tx, mut rx) = mpsc::channel(1);
let handle = Handle {
room_jid: muc_jid.clone().into(),
room_jid: muc_jid.to_bare(),
tx: tx.clone(),
};
let mut client = AsyncClient::new(&jid, &password).unwrap();
let mut client = AsyncClient::new(Jid::new(&jid).unwrap(), &password);
loop {
match client.next().await {
Some(Event::Online { .. }) => {

View File

@ -24,7 +24,7 @@ impl Location {
}
}
pub fn contains(&self, coord: &geo::Coordinate<f64>) -> bool {
pub fn contains(&self, coord: &geo::Coord<f64>) -> bool {
self.poly.contains(coord)
}
}
@ -54,7 +54,7 @@ impl Locations {
.as_f64().expect("lon f64");
let lat = el.get("lat").expect("lat")
.as_f64().expect("lat f64");
let coord = geo::Coordinate { x: lon, y: lat };
let coord = geo::Coord { x: lon, y: lat };
nodes.insert(id, coord);
}
_ => {}
@ -168,7 +168,7 @@ impl Locations {
}
}
pub fn find(&self, coord: &geo::Coordinate<f64>) -> Option<Arc<String>> {
pub fn find(&self, coord: &geo::Coord<f64>) -> Option<Arc<String>> {
for l in &self.locations {
if l.contains(coord) {
return Some(l.name.clone());