accept fixes
This commit is contained in:
parent
0cabdde59a
commit
970e53304c
|
@ -131,7 +131,9 @@ checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libcwtch"
|
name = "libcwtch"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "25c487f128e73d0c8a18f421f67efa7cf0b3ee913dbd2b1ef49b0854e25abf85"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hex-literal",
|
"hex-literal",
|
||||||
"libc",
|
"libc",
|
||||||
|
|
19
src/main.rs
19
src/main.rs
|
@ -93,10 +93,7 @@ impl UpdateBot {
|
||||||
Some(last_offered) => last_offered != self.version,
|
Some(last_offered) => last_offered != self.version,
|
||||||
None => true,
|
None => true,
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => false
|
||||||
println!("Error parsing attribute: {}", e);
|
|
||||||
false
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if do_offer {
|
if do_offer {
|
||||||
self.offer(cwtch, profile_opt, convo_id);
|
self.offer(cwtch, profile_opt, convo_id);
|
||||||
|
@ -132,18 +129,18 @@ impl imp::EventHandler for UpdateBot {
|
||||||
let event_type = Event::from(event.event_type.as_str());
|
let event_type = Event::from(event.event_type.as_str());
|
||||||
match event_type {
|
match event_type {
|
||||||
Event::ContactCreated => {
|
Event::ContactCreated => {
|
||||||
if event.data["ConnectionState"] == "Authenticated" {
|
let convo_id = event.data["ConversationID"].parse::<i32>().unwrap();
|
||||||
let convo_id = event.data["ConversationID"].parse::<i32>().unwrap();
|
self.greet(cwtch, profile_opt, convo_id);
|
||||||
self.greet(cwtch, profile_opt, convo_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Event::PeerStateChange => {
|
Event::PeerStateChange => {
|
||||||
if event.data["ConnectionState"] == "Authenticated" {
|
if event.data["ConnectionState"] == "Authenticated" {
|
||||||
match profile_opt.as_ref() {
|
match profile_opt.as_ref() {
|
||||||
Some(profile) => {
|
Some(profile) => {
|
||||||
let conversation =
|
if profile.conversations.contains_key(&event.data["RemotePeer"]) {
|
||||||
&profile.conversations[&event.data["RemotePeer"]];
|
let conversation =
|
||||||
self.greet(cwtch, profile_opt, conversation.identifier);
|
&profile.conversations[&event.data["RemotePeer"]];
|
||||||
|
self.greet(cwtch, profile_opt, conversation.identifier);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
None => (),
|
None => (),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue