migrate to libcwtch-go 1.5 #9
Loading…
Reference in New Issue
No description provided.
Delete Branch "lcg1.5"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I was able to extend the macro_rules! macro to support the new APIs as it turns out!
so all the most uptodate libcwtch-go is here!
also added deserialization error handleing with Result as per #4
@ -14,3 +14,3 @@
serde_json = "1.0"
serde = { version = "1.0.127", features = ["derive"] }
serde_with = { version = "1.10.0" }
serde_with = { version = "1.10.0" }
what is this needed for?
https://git.openprivacy.ca/cwtch.im/libcwtch-rs/src/branch/main/src/structs.rs#L3
https://git.openprivacy.ca/cwtch.im/libcwtch-rs/src/branch/main/src/structs.rs#L56
https://git.openprivacy.ca/cwtch.im/libcwtch-rs/src/branch/main/src/structs.rs#L65
which i beleive is being used so ConnectionState deserizliaes to default / Disconnected on error / absent
@ -15,3 +14,2 @@
Command::new("wget").arg("https://git.openprivacy.ca/attachments/e77c69f0-9487-4808-bc23-092d943bc4a6").arg("-O").arg(lib_cwtch_path).output().expect("failed to download libCwtch.so");
}
// https://git.openprivacy.ca/cwtch.im/libcwtch-go/releases v1.5.4
would be really nice to include a hash here to check the received lib against
@ -8,2 +8,3 @@
let bot_home = "example_cwtch_dir";
std::fs::remove_dir_all(&bot_home).expect("Error removing previous bot_home directory");
match std::fs::remove_dir_all(&bot_home) {
_ => (),
handle the error here
remove_dir_all fails on first run as there's no cwtch bot test dir, so i'm catching and ignoring the error.
is there a more idiomatic way to do this?
@ -31,3 +31,3 @@
fn drop(&mut self) {
unsafe {
CString::from_raw(self.raw);
drop(CString::from_raw(self.raw));
I don't think you need an explicit drop here...it should go out of scope automatically?
compiler says otherwise
@ -153,1 +162,3 @@
let servers_map: Vec<Server> = serde_json::from_str(servers_json).unwrap();
let servers_map: Vec<Server> = match serde_json::from_str(servers_json) {
Ok(sm) => sm,
Err(e) => return Err(format!("invalid jason: {:?}", e))
jason
dfd3d0b992
to81fbfdd151