From 5db5208a54bb79790f7035ba43aa16784d434995 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Sun, 16 Jan 2022 14:00:21 -0500 Subject: [PATCH] lcg 1.5.2 to 1.5.4 unblock_contact() --- build.rs | 4 ++-- libCwtch.h | 2 +- src/bindings_go.rs | 3 +-- src/cwtchlib_go/bindings.rs | 7 +++++++ src/lib.rs | 3 +-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/build.rs b/build.rs index d7379d4..f8d4825 100644 --- a/build.rs +++ b/build.rs @@ -11,6 +11,6 @@ fn main() { println!("cargo:rerun-if-changed=libCwtch.h"); let lib_cwtch_path = Path::new(&out_dir).join("libCwtch.so"); - // https://git.openprivacy.ca/cwtch.im/libcwtch-go/releases v1.5.2 - Command::new("wget").arg("https://git.openprivacy.ca/attachments/3e563341-c206-4e69-98e3-e0dca449f947").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 + 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"); } \ No newline at end of file diff --git a/libCwtch.h b/libCwtch.h index 70c2395..de34689 100644 --- a/libCwtch.h +++ b/libCwtch.h @@ -16,7 +16,6 @@ typedef struct { const char *p; ptrdiff_t n; } _GoString_; #endif - /* Start of boilerplate cgo prologue. */ #line 1 "cgo-gcc-export-header-prolog" @@ -76,6 +75,7 @@ extern void c_CreateProfile(char* nick_ptr, int nick_len, char* pass_ptr, int pa extern void c_LoadProfiles(char* passwordPtr, int passwordLen); extern void c_AcceptConversation(char* profilePtr, int profileLen, int conversation_id); extern void c_BlockContact(char* profilePtr, int profileLen, int conversation_id); +extern void c_UnblockContact(char* profilePtr, int profileLen, int conversation_id); // the pointer returned from this function **must** be Freed by c_Free extern char* c_GetMessage(char* profile_ptr, int profile_len, int conversation_id, int message_index); diff --git a/src/bindings_go.rs b/src/bindings_go.rs index af3239c..9f28e4d 100644 --- a/src/bindings_go.rs +++ b/src/bindings_go.rs @@ -89,8 +89,7 @@ impl CwtchLib for CwtchLibGo { c_bind!(load_profiles(pass: &str;;) c_LoadProfiles); c_bind!(accept_conversation(profile: &str ; conversation_id: i32 ;) c_AcceptConversation); c_bind!(block_contact(profile: &str ; conversation_id: i32; ) c_BlockContact); - // todo 1.5.3 - //c_bind!(unblock_contact(profile: &str ; conversation_id: i32; ) c_UnblockContact); + c_bind!(unblock_contact(profile: &str ; conversation_id: i32; ) c_UnblockContact); c_bind!(get_message(profile: &str; conversation_id: i32, message_index: i32 ;) c_GetMessage -> String); c_bind!(get_message_by_id(profile: &str ; conversation_id: i32, message_id: i32 ;) c_GetMessageByID -> String); c_bind!(get_message_by_content_hash(profile: &str ; conversation_id: i32 ; hash: &str) c_GetMessagesByContentHash -> String); diff --git a/src/cwtchlib_go/bindings.rs b/src/cwtchlib_go/bindings.rs index 5bbd780..cd4ab52 100644 --- a/src/cwtchlib_go/bindings.rs +++ b/src/cwtchlib_go/bindings.rs @@ -253,6 +253,13 @@ extern "C" { conversation_id: ::std::os::raw::c_int, ); } +extern "C" { + pub fn c_UnblockContact( + profilePtr: *mut ::std::os::raw::c_char, + profileLen: ::std::os::raw::c_int, + conversation_id: ::std::os::raw::c_int, + ); +} extern "C" { pub fn c_GetMessage( profile_ptr: *mut ::std::os::raw::c_char, diff --git a/src/lib.rs b/src/lib.rs index 70f5da0..6f16913 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,9 +35,8 @@ pub trait CwtchLib { /// Cause profile to block conversation fn block_contact(&self, profile: &str, conversation_id: i32); - // TODO 1.5.3 /// Cause profile to unblock contact - //fn unblock_contact(&self, profile: &str, conversation_id: i32); + fn unblock_contact(&self, profile: &str, conversation_id: i32); /// Get a specific message for conversation of profile by index fn get_message(&self, profile: &str, conversation_id: i32, message_index: i32) -> String;