rust fmt
This commit is contained in:
parent
5db5208a54
commit
a28813fb2e
9
build.rs
9
build.rs
|
@ -1,6 +1,6 @@
|
||||||
use std::process::Command;
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let out_dir = env::var_os("OUT_DIR").unwrap();
|
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||||
|
@ -12,5 +12,10 @@ fn main() {
|
||||||
|
|
||||||
let lib_cwtch_path = Path::new(&out_dir).join("libCwtch.so");
|
let lib_cwtch_path = Path::new(&out_dir).join("libCwtch.so");
|
||||||
// https://git.openprivacy.ca/cwtch.im/libcwtch-go/releases v1.5.4
|
// https://git.openprivacy.ca/cwtch.im/libcwtch-go/releases v1.5.4
|
||||||
Command::new("wget").arg("https://git.openprivacy.ca/attachments/dd3c6b41-98e4-4e7b-81af-d21893bfe389").arg("-O").arg(lib_cwtch_path).output().expect("failed to download libCwtch.so");
|
Command::new("wget")
|
||||||
|
.arg("https://git.openprivacy.ca/attachments/dd3c6b41-98e4-4e7b-81af-d21893bfe389")
|
||||||
|
.arg("-O")
|
||||||
|
.arg(lib_cwtch_path)
|
||||||
|
.output()
|
||||||
|
.expect("failed to download libCwtch.so");
|
||||||
}
|
}
|
|
@ -7,7 +7,7 @@ use libcwtch::CwtchLib;
|
||||||
fn main() {
|
fn main() {
|
||||||
let bot_home = "example_cwtch_dir";
|
let bot_home = "example_cwtch_dir";
|
||||||
match std::fs::remove_dir_all(&bot_home) {
|
match std::fs::remove_dir_all(&bot_home) {
|
||||||
_ => ()
|
_ => (),
|
||||||
}
|
}
|
||||||
std::fs::create_dir_all(&bot_home).expect("Error creating bot_home directory");
|
std::fs::create_dir_all(&bot_home).expect("Error creating bot_home directory");
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ macro_rules! c_bind {
|
||||||
|
|
||||||
pub struct CwtchLibGo {}
|
pub struct CwtchLibGo {}
|
||||||
|
|
||||||
impl CwtchLib for CwtchLibGo {
|
impl CwtchLib for CwtchLibGo {
|
||||||
c_bind!(start_cwtch(app_dir: &str, tor_path: &str;;) c_StartCwtch -> i32);
|
c_bind!(start_cwtch(app_dir: &str, tor_path: &str;;) c_StartCwtch -> i32);
|
||||||
c_bind!(send_app_event(event_json: &str;;) c_SendAppEvent);
|
c_bind!(send_app_event(event_json: &str;;) c_SendAppEvent);
|
||||||
c_bind!(send_profile_event(profile: &str, event_jason: &str;;) c_SendProfileEvent);
|
c_bind!(send_profile_event(profile: &str, event_jason: &str;;) c_SendProfileEvent);
|
||||||
|
|
26
src/lib.rs
26
src/lib.rs
|
@ -45,7 +45,12 @@ pub trait CwtchLib {
|
||||||
fn get_message_by_id(&self, profile: &str, conversation_id: i32, message_id: i32) -> String;
|
fn get_message_by_id(&self, profile: &str, conversation_id: i32, message_id: i32) -> String;
|
||||||
|
|
||||||
/// Get a specific message for conversation of profile by hash
|
/// Get a specific message for conversation of profile by hash
|
||||||
fn get_message_by_content_hash(&self, profile: &str, conversation_id: i32, hash: &str) -> String;
|
fn get_message_by_content_hash(
|
||||||
|
&self,
|
||||||
|
profile: &str,
|
||||||
|
conversation_id: i32,
|
||||||
|
hash: &str,
|
||||||
|
) -> String;
|
||||||
|
|
||||||
/// Send json of a structs::Message from profile to contact
|
/// Send json of a structs::Message from profile to contact
|
||||||
fn send_message(&self, profile: &str, conversation_id: i32, msg: &str);
|
fn send_message(&self, profile: &str, conversation_id: i32, msg: &str);
|
||||||
|
@ -57,7 +62,14 @@ pub trait CwtchLib {
|
||||||
fn share_file(&self, profile: &str, conversation_id: i32, file_path: &str);
|
fn share_file(&self, profile: &str, conversation_id: i32, file_path: &str);
|
||||||
|
|
||||||
/// download a file from a conversation to the file_path
|
/// download a file from a conversation to the file_path
|
||||||
fn download_file(&self, profile: &str, conversation_id: i32, file_path: &str, manifest_path: &str, file_key: &str);
|
fn download_file(
|
||||||
|
&self,
|
||||||
|
profile: &str,
|
||||||
|
conversation_id: i32,
|
||||||
|
file_path: &str,
|
||||||
|
manifest_path: &str,
|
||||||
|
file_key: &str,
|
||||||
|
);
|
||||||
|
|
||||||
/// Query the status of a download
|
/// Query the status of a download
|
||||||
fn check_download_status(&self, profile: &str, file_key: &str);
|
fn check_download_status(&self, profile: &str, file_key: &str);
|
||||||
|
@ -90,7 +102,15 @@ pub trait CwtchLib {
|
||||||
fn set_conversation_attribute(&self, profile: &str, conversation_id: i32, key: &str, val: &str);
|
fn set_conversation_attribute(&self, profile: &str, conversation_id: i32, key: &str, val: &str);
|
||||||
|
|
||||||
/// Set an attribute on a message in a conversation
|
/// Set an attribute on a message in a conversation
|
||||||
fn set_message_attribute(&self, profile: &str, conversation_id: i32, channel_id: i32, message_id: i32, attribute_key: &str, attribute_value: &str);
|
fn set_message_attribute(
|
||||||
|
&self,
|
||||||
|
profile: &str,
|
||||||
|
conversation_id: i32,
|
||||||
|
channel_id: i32,
|
||||||
|
message_id: i32,
|
||||||
|
attribute_key: &str,
|
||||||
|
attribute_value: &str,
|
||||||
|
);
|
||||||
|
|
||||||
/// Change a profile's password to new_pass if old_pass is correct
|
/// Change a profile's password to new_pass if old_pass is correct
|
||||||
fn change_password(&self, profile: &str, old_pass: &str, new_pass: &str, new_pass_again: &str);
|
fn change_password(&self, profile: &str, old_pass: &str, new_pass: &str, new_pass_again: &str);
|
||||||
|
|
Loading…
Reference in New Issue