From fbd65fde261e6d8cc29d41158d854a4ae4a673bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 14 Feb 2020 14:37:10 +0100 Subject: [PATCH] nio-olm: Remove our olm bindings since we're gonna use olm-rs. --- nio-olm/nio-olm-rs/Cargo.toml | 10 ------- nio-olm/nio-olm-rs/src/account.rs | 46 ------------------------------- nio-olm/nio-olm-rs/src/lib.rs | 1 - nio-olm/nio-olm-sys/Cargo.toml | 14 ---------- nio-olm/nio-olm-sys/build.rs | 21 -------------- nio-olm/nio-olm-sys/src/lib.rs | 5 ---- nio-olm/nio-olm-sys/src/wrapper.h | 1 - 7 files changed, 98 deletions(-) delete mode 100644 nio-olm/nio-olm-rs/Cargo.toml delete mode 100644 nio-olm/nio-olm-rs/src/account.rs delete mode 100644 nio-olm/nio-olm-rs/src/lib.rs delete mode 100644 nio-olm/nio-olm-sys/Cargo.toml delete mode 100644 nio-olm/nio-olm-sys/build.rs delete mode 100644 nio-olm/nio-olm-sys/src/lib.rs delete mode 100644 nio-olm/nio-olm-sys/src/wrapper.h diff --git a/nio-olm/nio-olm-rs/Cargo.toml b/nio-olm/nio-olm-rs/Cargo.toml deleted file mode 100644 index af765a4f..00000000 --- a/nio-olm/nio-olm-rs/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "nio-olm-rs" -version = "3.1.4-beta" -authors = ["Damir Jelić "] -description = "Higher level bindings for the Olm C library" -license = "ISC" -edition = "2018" - -[dependencies] -nio-olm-sys = { path = "../nio-olm-sys" } diff --git a/nio-olm/nio-olm-rs/src/account.rs b/nio-olm/nio-olm-rs/src/account.rs deleted file mode 100644 index cc0b0146..00000000 --- a/nio-olm/nio-olm-rs/src/account.rs +++ /dev/null @@ -1,46 +0,0 @@ -use nio_olm_sys::OlmAccount; - -pub struct Account { - account: *mut OlmAccount, - buffer: Vec, -} - -pub struct IdentityKeys { - ed25519: String, - curve25519: String, -} - -impl Account { - #[allow(clippy::new_without_default)] - pub fn new() -> Account { - let account_size = unsafe { nio_olm_sys::olm_account_size() }; - - let account_data: Vec = vec![0; account_size]; - - let acc_ptr = unsafe { nio_olm_sys::olm_account(account_data.as_ptr() as *mut _) }; - - Account { - account: acc_ptr, - buffer: account_data, - } - } - - pub fn identity_keys(&self) { - let keys_length = unsafe { nio_olm_sys::olm_account_identity_keys_length(self.account) }; - - let out_buffer: Vec = vec![0; keys_length]; - } -} - -impl Drop for Account { - fn drop(&mut self) { - unsafe { - nio_olm_sys::olm_clear_account(self.account); - } - } -} - -#[test] -fn create_account() { - Account::new(); -} diff --git a/nio-olm/nio-olm-rs/src/lib.rs b/nio-olm/nio-olm-rs/src/lib.rs deleted file mode 100644 index b0edc6c1..00000000 --- a/nio-olm/nio-olm-rs/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod account; diff --git a/nio-olm/nio-olm-sys/Cargo.toml b/nio-olm/nio-olm-sys/Cargo.toml deleted file mode 100644 index 558b8326..00000000 --- a/nio-olm/nio-olm-sys/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "nio-olm-sys" -version = "3.1.4-beta" -authors = ["Damir Jelić "] -description = "Low level bindings for the Olm C library" -license = "ISC" -edition = "2018" -build = "build.rs" - -[build-dependencies] -bindgen = "0.51.1" - -[dependencies] -libc = "0.2.65" diff --git a/nio-olm/nio-olm-sys/build.rs b/nio-olm/nio-olm-sys/build.rs deleted file mode 100644 index 063966f6..00000000 --- a/nio-olm/nio-olm-sys/build.rs +++ /dev/null @@ -1,21 +0,0 @@ -use bindgen::Bindings; -use std::env; -use std::path::PathBuf; - -fn build(file: &str) -> Result { - println!("cargo:rustc-link-lib=olm"); - - bindgen::Builder::default() - .rustfmt_bindings(true) - .header(file) - .generate() -} - -fn main() { - let bindings = build("src/wrapper.h").expect("Unable to build bindings"); - let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); - - bindings - .write_to_file(out_path.join("bindings.rs")) - .expect("Couldn't write bindings!"); -} diff --git a/nio-olm/nio-olm-sys/src/lib.rs b/nio-olm/nio-olm-sys/src/lib.rs deleted file mode 100644 index a38a13a8..00000000 --- a/nio-olm/nio-olm-sys/src/lib.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![allow(non_upper_case_globals)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] - -include!(concat!(env!("OUT_DIR"), "/bindings.rs")); diff --git a/nio-olm/nio-olm-sys/src/wrapper.h b/nio-olm/nio-olm-sys/src/wrapper.h deleted file mode 100644 index ea193d26..00000000 --- a/nio-olm/nio-olm-sys/src/wrapper.h +++ /dev/null @@ -1 +0,0 @@ -#include