diff --git a/Cargo.lock b/Cargo.lock index 0304294..9df7ace 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,9 +151,9 @@ checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "libcwtch" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25c487f128e73d0c8a18f421f67efa7cf0b3ee913dbd2b1ef49b0854e25abf85" +checksum = "82cfe2b14be43f9f77596fa12beb3a12a3e2c12eaa82b25be933d537e6e3d4f9" dependencies = [ "hex-literal", "libc", diff --git a/Cargo.toml b/Cargo.toml index a6e7744..e95d993 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -libcwtch = "0.3.0" +libcwtch = "0.3.2" imp = {path = "../imp"} serde_json = "1.0" diff --git a/src/main.rs b/src/main.rs index 329d455..1ca1df7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,22 +1,21 @@ extern crate core; -use std::borrow::{Borrow, BorrowMut}; -use std::collections::HashMap; +use std::borrow::{BorrowMut}; use std::fs::read_dir; use std::path::{Path, PathBuf}; use std::thread; use ::imp::event::Event; use ::imp::imp; -use ::imp::imp::EventHandler; -use ::imp::imp::NewContactPolicy; +use ::imp::behaviour; +use ::imp::behaviour::BehaviourBuilder; +use ::imp::behaviour::Behaviour; +use ::imp::imp::Imp; use libcwtch; use libcwtch::CwtchLib; use libcwtch::structs::*; use serde_json; -use crate::imp::{Behaviour, BehaviourBuilder, Imp}; - const DIST_DIR: &str = "cwtch_dist"; const BOT_HOME: &str = "~/.cwtch/bots/update_bot"; const PASSWORD: &str = "be gay do crime"; @@ -72,7 +71,7 @@ fn main() { } let mut update_bot = UpdateBot::new(); - let behaviour: Behaviour = BehaviourBuilder::new().name(BOT_NAME.to_string()).profile_pic_path("build_bot.png".to_string()).new_contact_policy(imp::NewContactPolicy::Accept).build(); + let behaviour: Behaviour = BehaviourBuilder::new().name(BOT_NAME.to_string()).profile_pic_path("build_bot.png".to_string()).new_contact_policy(behaviour::NewContactPolicy::Accept).build(); let event_loop_handle = thread::spawn(move || { let mut bot = Imp::spawn(behaviour, PASSWORD.to_string(), BOT_HOME.to_string()); @@ -96,7 +95,7 @@ impl UpdateBot { Some(last_offered) => last_offered != self.version, None => true, }, - Err(e) => false + Err(_) => false }; if do_offer { self.offer(cwtch, profile_opt, convo_id); @@ -148,7 +147,7 @@ impl imp::EventHandler for UpdateBot { }; } } - Event::NewMessageFromPeer { conversation_id, handle, timestamp_received, message } => { + Event::NewMessageFromPeer { conversation_id, handle: _, timestamp_received: _, message } => { match profile_opt { Some(profile) => { let from = profile.handle.as_str(); @@ -186,7 +185,7 @@ impl imp::EventHandler for UpdateBot { _ => {} } } - Event::ErrUnhandled { name, data } => eprintln!("unhandled event: {}!", name), + Event::ErrUnhandled { name, data: _ } => eprintln!("unhandled event: {}!", name), _ => () }; }