upgrade to autobindings 0.0.12
This commit is contained in:
parent
98571f5559
commit
a148e1af47
|
@ -215,7 +215,7 @@ checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
|||
|
||||
[[package]]
|
||||
name = "libcwtch"
|
||||
version = "0.7.0"
|
||||
version = "0.8.0"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"chrono",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "libcwtch"
|
||||
version = "0.7.0"
|
||||
version = "0.8.0"
|
||||
authors = ["Dan Ballard <dan@mindstab.net>"]
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
|
|
5
build.rs
5
build.rs
|
@ -42,9 +42,8 @@ fn main() {
|
|||
|
||||
let lib_cwtch_path = Path::new(&out_dir).join("libCwtch.so");
|
||||
if std::env::var("LCG_DIR").is_err() {
|
||||
// https://git.openprivacy.ca/cwtch.im/libcwtch-go/releases v1.7.1
|
||||
Command::new("wget")
|
||||
.arg("https://git.openprivacy.ca/attachments/888a3255-0b9e-430d-b164-84322fa96ae0")
|
||||
.arg("https://git.openprivacy.ca/cwtch.im/autobindings/releases/download/v0.0.12/libCwtch.x64.so")
|
||||
.arg("-O")
|
||||
.arg(lib_cwtch_path.clone())
|
||||
.output()
|
||||
|
@ -55,7 +54,7 @@ fn main() {
|
|||
io::copy(&mut file, &mut hasher).expect("failed to copy file into hasher");
|
||||
let hash_bytes = hasher.finalize();
|
||||
|
||||
assert_eq!(hash_bytes[..], hex!("98b34082987cc293b42de2e92f990d84c1c7978222ce4e343dd135b46a014f0d5f2e8f8e3de1ebe41354bf9e221edb57f4e252ce9542cbb865fe699dd606f102")[..]);
|
||||
assert_eq!(hash_bytes[..], hex!("a3742e0cdedc00eb3673063b100b7596b05bdc9bb68a0fba6fd2423c9a41f1653597c4d44ba3877be08cbb5bba2806435830061ab3517cdd4472a18c7557d9c7")[..]);
|
||||
} else {
|
||||
let local_lcg = Path::new(std::env::var("LCG_DIR").unwrap().as_str()).join("libCwtch.so");
|
||||
fs::copy(local_lcg, lib_cwtch_path).expect("could not find local lcg");
|
||||
|
|
42
libCwtch.h
42
libCwtch.h
|
@ -102,35 +102,37 @@ extern void c_UnblockConversation(char* onion_ptr, int onion_len, int conversati
|
|||
extern void c_DeleteConversation(char* onion_ptr, int onion_len, int conversation);
|
||||
extern void c_PeerWithOnion(char* onion_ptr, int onion_len, char* handle11_ptr, int handle11_len);
|
||||
extern void c_DisconnectFromPeer(char* onion_ptr, int onion_len, char* handle12_ptr, int handle12_len);
|
||||
extern char* c_SearchConversations(char* onion_ptr, int onion_len, char* pattern13_ptr, int pattern13_len);
|
||||
extern char* c_SendMessage(char* onion_ptr, int onion_len, int conversation, char* msg14_ptr, int msg14_len);
|
||||
extern char* c_GetConversationAccessControlList(char* onion_ptr, int onion_len, int conversation);
|
||||
extern void c_UpdateConversationAccessControlList(char* onion_ptr, int onion_len, int conversation, char* json13_ptr, int json13_len);
|
||||
extern char* c_SearchConversations(char* onion_ptr, int onion_len, char* pattern14_ptr, int pattern14_len);
|
||||
extern char* c_SendMessage(char* onion_ptr, int onion_len, int conversation, char* msg15_ptr, int msg15_len);
|
||||
extern char* c_GetMessageById(char* onion_ptr, int onion_len, int conversation, int message_id);
|
||||
extern char* c_GetMessageByContentHash(char* onion_ptr, int onion_len, int conversation, char* contentHash15_ptr, int contentHash15_len);
|
||||
extern char* c_GetMessages(char* onion_ptr, int onion_len, int conversation, int index, int count);
|
||||
extern char* c_GetMessageByContentHash(char* onion_ptr, int onion_len, int conversation, char* contentHash16_ptr, int contentHash16_len);
|
||||
extern char* c_GetMessages(char* onion_ptr, int onion_len, int conversation, int index, unsigned int count);
|
||||
extern char* c_SendInviteMessage(char* onion_ptr, int onion_len, int conversation, int target);
|
||||
extern void c_UpdateMessageAttribute(char* onion_ptr, int onion_len, int conversation, int channel_id, int message_id, char* attributeKey16_ptr, int attributeKey16_len, char* attributeValue17_ptr, int attributeValue17_len);
|
||||
extern void c_StartGroup(char* onion_ptr, int onion_len, char* name18_ptr, int name18_len, char* server19_ptr, int server19_len);
|
||||
extern void c_QueueJoinServer(char* onion_ptr, int onion_len, char* handle20_ptr, int handle20_len);
|
||||
extern void c_DisconnectFromServer(char* onion_ptr, int onion_len, char* handle21_ptr, int handle21_len);
|
||||
extern void c_UpdateMessageAttribute(char* onion_ptr, int onion_len, int conversation, int channel_id, int message_id, char* attributeKey17_ptr, int attributeKey17_len, char* attributeValue18_ptr, int attributeValue18_len);
|
||||
extern void c_StartGroup(char* onion_ptr, int onion_len, char* name19_ptr, int name19_len, char* server20_ptr, int server20_len);
|
||||
extern void c_QueueJoinServer(char* onion_ptr, int onion_len, char* handle21_ptr, int handle21_len);
|
||||
extern void c_DisconnectFromServer(char* onion_ptr, int onion_len, char* handle22_ptr, int handle22_len);
|
||||
extern void c_PublishServerUpdate(char* onion_ptr, int onion_len);
|
||||
extern void c_GetServerInfoList(char* onion_ptr, int onion_len);
|
||||
extern void c_DeleteServerInfo(char* onion_ptr, int onion_len, char* serverOnion22_ptr, int serverOnion22_len);
|
||||
extern void c_DownloadFileDefaultLimit(char* onion_ptr, int onion_len, int conversation, char* filepath23_ptr, int filepath23_len, char* manifest24_ptr, int manifest24_len, char* filekey25_ptr, int filekey25_len);
|
||||
extern void c_RestartFileShare(char* onion_ptr, int onion_len, char* filekey26_ptr, int filekey26_len);
|
||||
extern void c_StopFileShare(char* onion_ptr, int onion_len, char* filekey27_ptr, int filekey27_len);
|
||||
extern void c_CheckDownloadStatus(char* onion_ptr, int onion_len, char* filekey28_ptr, int filekey28_len);
|
||||
extern void c_VerifyOrResumeDownloadDefaultLimit(char* onion_ptr, int onion_len, int conversation, char* filekey29_ptr, int filekey29_len);
|
||||
extern char* c_ShareFile(char* onion_ptr, int onion_len, int conversation, char* filepath30_ptr, int filepath30_len);
|
||||
extern void c_DeleteServerInfo(char* onion_ptr, int onion_len, char* serverOnion23_ptr, int serverOnion23_len);
|
||||
extern void c_DownloadFileDefaultLimit(char* onion_ptr, int onion_len, int conversation, char* filepath24_ptr, int filepath24_len, char* manifest25_ptr, int manifest25_len, char* filekey26_ptr, int filekey26_len);
|
||||
extern void c_RestartFileShare(char* onion_ptr, int onion_len, char* filekey27_ptr, int filekey27_len);
|
||||
extern void c_StopFileShare(char* onion_ptr, int onion_len, char* filekey28_ptr, int filekey28_len);
|
||||
extern void c_CheckDownloadStatus(char* onion_ptr, int onion_len, char* filekey29_ptr, int filekey29_len);
|
||||
extern void c_VerifyOrResumeDownloadDefaultLimit(char* onion_ptr, int onion_len, int conversation, char* filekey30_ptr, int filekey30_len);
|
||||
extern char* c_ShareFile(char* onion_ptr, int onion_len, int conversation, char* filepath31_ptr, int filepath31_len);
|
||||
extern char* c_GetSharedFiles(char* onion_ptr, int onion_len, int conversation);
|
||||
extern void c_CreateServer(char* password_ptr, int password_len, char* description31_ptr, int description31_len, char autostart32);
|
||||
extern void c_SetServerAttribute(char* handle33_ptr, int handle33_len, char* key34_ptr, int key34_len, char* val35_ptr, int val35_len);
|
||||
extern void c_CreateServer(char* password_ptr, int password_len, char* description32_ptr, int description32_len, char autostart33);
|
||||
extern void c_SetServerAttribute(char* handle34_ptr, int handle34_len, char* key35_ptr, int key35_len, char* val36_ptr, int val36_len);
|
||||
extern void c_LoadServers(char* password_ptr, int password_len);
|
||||
extern void c_LaunchServers();
|
||||
extern void c_LaunchServer(char* handle36_ptr, int handle36_len);
|
||||
extern void c_StopServer(char* handle37_ptr, int handle37_len);
|
||||
extern void c_LaunchServer(char* handle37_ptr, int handle37_len);
|
||||
extern void c_StopServer(char* handle38_ptr, int handle38_len);
|
||||
extern void c_StopServers();
|
||||
extern void c_DestroyServers();
|
||||
extern void c_DeleteServer(char* handle38_ptr, int handle38_len, char* password_ptr, int password_len);
|
||||
extern void c_DeleteServer(char* handle39_ptr, int handle39_len, char* password_ptr, int password_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -109,9 +109,11 @@ impl CwtchLibGo {
|
|||
c_bind!(_unblock_conversation(profile: &str ; conversation_id: i32; ) c_UnblockConversation);
|
||||
c_bind!(_disconnect_from_peer(profile: &str, peer_address: &str;;) c_DisconnectFromPeer);
|
||||
c_bind!(_search_conversations(profile: &str, pattern: &str;;) c_SearchConversations -> String);
|
||||
c_bind!(_get_conversation_access_control_list(profile: &str; conversation_id: i32;) c_GetConversationAccessControlList -> String);
|
||||
c_bind!(_update_conversation_access_control_list(profile: &str; conversation_id: i32; acl: &str) c_UpdateConversationAccessControlList);
|
||||
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_GetMessageByContentHash -> String);
|
||||
c_bind!(_get_messages(profile: &str; conversation_id: i32, message_index: i32, count: i32 ;) c_GetMessages -> String);
|
||||
c_bind!(_get_messages(profile: &str; conversation_id: i32, message_index: i32, count: u32 ;) c_GetMessages -> String);
|
||||
c_bind!(_send_message(profile: &str; conversation_id: i32; msg: &str) c_SendMessage -> String);
|
||||
c_bind!(_send_invite_message(profile: &str; conversation_id: i32, target_id: i32;) c_SendInviteMessage -> String);
|
||||
c_bind!(_share_file(profile: &str; conversation_id: i32; file_path: &str) c_ShareFile -> String);
|
||||
|
@ -171,6 +173,22 @@ impl CwtchLib for CwtchLibGo {
|
|||
self._search_conversations(profile.as_str(), pattern)
|
||||
}
|
||||
|
||||
fn get_conversation_access_control_list(&self, profile: &ProfileIdentity, conversation_id: ConversationID) -> Result<ACL, CwtchError> {
|
||||
let json = self._get_conversation_access_control_list(profile.as_str(), conversation_id.into());
|
||||
|
||||
match serde_json::from_str(&json) {
|
||||
Ok(acl) => Ok(acl),
|
||||
Err(e) => Err(e.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
fn update_conversation_access_control_list(&self, profile: &ProfileIdentity, conversation_id: ConversationID, acl: ACL) {
|
||||
match serde_json::to_string(&acl) {
|
||||
Ok(acl_json) => self._update_conversation_access_control_list(profile.as_str(), conversation_id.into(), &acl_json),
|
||||
Err(_) => return,
|
||||
};
|
||||
}
|
||||
|
||||
c_bind!(load_profiles(pass: &str;;) c_LoadProfiles);
|
||||
fn accept_conversation(&self, profile: &ProfileIdentity, conversation_id: ConversationID) {
|
||||
self._accept_conversation(profile.as_str(), conversation_id.into())
|
||||
|
@ -196,7 +214,7 @@ impl CwtchLib for CwtchLibGo {
|
|||
fn get_message_by_content_hash(&self, profile: &ProfileIdentity, conversation_id: ConversationID, hash: &str) -> String {
|
||||
self._get_message_by_content_hash(String::from(profile).as_str(), conversation_id.into(), hash)
|
||||
}
|
||||
fn get_messages(&self, profile: &ProfileIdentity, conversation_id: ConversationID, message_index: i32, count: i32) -> String {
|
||||
fn get_messages(&self, profile: &ProfileIdentity, conversation_id: ConversationID, message_index: i32, count: u32) -> String {
|
||||
self._get_messages(String::from(profile).as_str(), conversation_id.into(), message_index, count)
|
||||
}
|
||||
fn send_message_raw(&self, profile: &ProfileIdentity, conversation_id: ConversationID, msg: &str) -> String {
|
||||
|
|
|
@ -404,12 +404,28 @@ extern "C" {
|
|||
handle12_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn c_GetConversationAccessControlList(
|
||||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
conversation: ::std::os::raw::c_int,
|
||||
) -> *mut ::std::os::raw::c_char;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn c_UpdateConversationAccessControlList(
|
||||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
conversation: ::std::os::raw::c_int,
|
||||
json13_ptr: *mut ::std::os::raw::c_char,
|
||||
json13_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn c_SearchConversations(
|
||||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
pattern13_ptr: *mut ::std::os::raw::c_char,
|
||||
pattern13_len: ::std::os::raw::c_int,
|
||||
pattern14_ptr: *mut ::std::os::raw::c_char,
|
||||
pattern14_len: ::std::os::raw::c_int,
|
||||
) -> *mut ::std::os::raw::c_char;
|
||||
}
|
||||
extern "C" {
|
||||
|
@ -417,8 +433,8 @@ extern "C" {
|
|||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
conversation: ::std::os::raw::c_int,
|
||||
msg14_ptr: *mut ::std::os::raw::c_char,
|
||||
msg14_len: ::std::os::raw::c_int,
|
||||
msg15_ptr: *mut ::std::os::raw::c_char,
|
||||
msg15_len: ::std::os::raw::c_int,
|
||||
) -> *mut ::std::os::raw::c_char;
|
||||
}
|
||||
extern "C" {
|
||||
|
@ -434,8 +450,8 @@ extern "C" {
|
|||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
conversation: ::std::os::raw::c_int,
|
||||
contentHash15_ptr: *mut ::std::os::raw::c_char,
|
||||
contentHash15_len: ::std::os::raw::c_int,
|
||||
contentHash16_ptr: *mut ::std::os::raw::c_char,
|
||||
contentHash16_len: ::std::os::raw::c_int,
|
||||
) -> *mut ::std::os::raw::c_char;
|
||||
}
|
||||
extern "C" {
|
||||
|
@ -444,7 +460,7 @@ extern "C" {
|
|||
onion_len: ::std::os::raw::c_int,
|
||||
conversation: ::std::os::raw::c_int,
|
||||
index: ::std::os::raw::c_int,
|
||||
count: ::std::os::raw::c_int,
|
||||
count: ::std::os::raw::c_uint,
|
||||
) -> *mut ::std::os::raw::c_char;
|
||||
}
|
||||
extern "C" {
|
||||
|
@ -462,36 +478,36 @@ extern "C" {
|
|||
conversation: ::std::os::raw::c_int,
|
||||
channel_id: ::std::os::raw::c_int,
|
||||
message_id: ::std::os::raw::c_int,
|
||||
attributeKey16_ptr: *mut ::std::os::raw::c_char,
|
||||
attributeKey16_len: ::std::os::raw::c_int,
|
||||
attributeValue17_ptr: *mut ::std::os::raw::c_char,
|
||||
attributeValue17_len: ::std::os::raw::c_int,
|
||||
attributeKey17_ptr: *mut ::std::os::raw::c_char,
|
||||
attributeKey17_len: ::std::os::raw::c_int,
|
||||
attributeValue18_ptr: *mut ::std::os::raw::c_char,
|
||||
attributeValue18_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn c_StartGroup(
|
||||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
name18_ptr: *mut ::std::os::raw::c_char,
|
||||
name18_len: ::std::os::raw::c_int,
|
||||
server19_ptr: *mut ::std::os::raw::c_char,
|
||||
server19_len: ::std::os::raw::c_int,
|
||||
name19_ptr: *mut ::std::os::raw::c_char,
|
||||
name19_len: ::std::os::raw::c_int,
|
||||
server20_ptr: *mut ::std::os::raw::c_char,
|
||||
server20_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn c_QueueJoinServer(
|
||||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
handle20_ptr: *mut ::std::os::raw::c_char,
|
||||
handle20_len: ::std::os::raw::c_int,
|
||||
handle21_ptr: *mut ::std::os::raw::c_char,
|
||||
handle21_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn c_DisconnectFromServer(
|
||||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
handle21_ptr: *mut ::std::os::raw::c_char,
|
||||
handle21_len: ::std::os::raw::c_int,
|
||||
handle22_ptr: *mut ::std::os::raw::c_char,
|
||||
handle22_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
|
@ -510,8 +526,8 @@ extern "C" {
|
|||
pub fn c_DeleteServerInfo(
|
||||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
serverOnion22_ptr: *mut ::std::os::raw::c_char,
|
||||
serverOnion22_len: ::std::os::raw::c_int,
|
||||
serverOnion23_ptr: *mut ::std::os::raw::c_char,
|
||||
serverOnion23_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
|
@ -519,24 +535,16 @@ extern "C" {
|
|||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
conversation: ::std::os::raw::c_int,
|
||||
filepath23_ptr: *mut ::std::os::raw::c_char,
|
||||
filepath23_len: ::std::os::raw::c_int,
|
||||
manifest24_ptr: *mut ::std::os::raw::c_char,
|
||||
manifest24_len: ::std::os::raw::c_int,
|
||||
filekey25_ptr: *mut ::std::os::raw::c_char,
|
||||
filekey25_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn c_RestartFileShare(
|
||||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
filepath24_ptr: *mut ::std::os::raw::c_char,
|
||||
filepath24_len: ::std::os::raw::c_int,
|
||||
manifest25_ptr: *mut ::std::os::raw::c_char,
|
||||
manifest25_len: ::std::os::raw::c_int,
|
||||
filekey26_ptr: *mut ::std::os::raw::c_char,
|
||||
filekey26_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn c_StopFileShare(
|
||||
pub fn c_RestartFileShare(
|
||||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
filekey27_ptr: *mut ::std::os::raw::c_char,
|
||||
|
@ -544,20 +552,28 @@ extern "C" {
|
|||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn c_CheckDownloadStatus(
|
||||
pub fn c_StopFileShare(
|
||||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
filekey28_ptr: *mut ::std::os::raw::c_char,
|
||||
filekey28_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn c_CheckDownloadStatus(
|
||||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
filekey29_ptr: *mut ::std::os::raw::c_char,
|
||||
filekey29_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn c_VerifyOrResumeDownloadDefaultLimit(
|
||||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
conversation: ::std::os::raw::c_int,
|
||||
filekey29_ptr: *mut ::std::os::raw::c_char,
|
||||
filekey29_len: ::std::os::raw::c_int,
|
||||
filekey30_ptr: *mut ::std::os::raw::c_char,
|
||||
filekey30_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
|
@ -565,8 +581,8 @@ extern "C" {
|
|||
onion_ptr: *mut ::std::os::raw::c_char,
|
||||
onion_len: ::std::os::raw::c_int,
|
||||
conversation: ::std::os::raw::c_int,
|
||||
filepath30_ptr: *mut ::std::os::raw::c_char,
|
||||
filepath30_len: ::std::os::raw::c_int,
|
||||
filepath31_ptr: *mut ::std::os::raw::c_char,
|
||||
filepath31_len: ::std::os::raw::c_int,
|
||||
) -> *mut ::std::os::raw::c_char;
|
||||
}
|
||||
extern "C" {
|
||||
|
@ -580,19 +596,19 @@ extern "C" {
|
|||
pub fn c_CreateServer(
|
||||
password_ptr: *mut ::std::os::raw::c_char,
|
||||
password_len: ::std::os::raw::c_int,
|
||||
description31_ptr: *mut ::std::os::raw::c_char,
|
||||
description31_len: ::std::os::raw::c_int,
|
||||
autostart32: ::std::os::raw::c_char,
|
||||
description32_ptr: *mut ::std::os::raw::c_char,
|
||||
description32_len: ::std::os::raw::c_int,
|
||||
autostart33: ::std::os::raw::c_char,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn c_SetServerAttribute(
|
||||
handle33_ptr: *mut ::std::os::raw::c_char,
|
||||
handle33_len: ::std::os::raw::c_int,
|
||||
key34_ptr: *mut ::std::os::raw::c_char,
|
||||
key34_len: ::std::os::raw::c_int,
|
||||
val35_ptr: *mut ::std::os::raw::c_char,
|
||||
val35_len: ::std::os::raw::c_int,
|
||||
handle34_ptr: *mut ::std::os::raw::c_char,
|
||||
handle34_len: ::std::os::raw::c_int,
|
||||
key35_ptr: *mut ::std::os::raw::c_char,
|
||||
key35_len: ::std::os::raw::c_int,
|
||||
val36_ptr: *mut ::std::os::raw::c_char,
|
||||
val36_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
|
@ -606,14 +622,14 @@ extern "C" {
|
|||
}
|
||||
extern "C" {
|
||||
pub fn c_LaunchServer(
|
||||
handle36_ptr: *mut ::std::os::raw::c_char,
|
||||
handle36_len: ::std::os::raw::c_int,
|
||||
handle37_ptr: *mut ::std::os::raw::c_char,
|
||||
handle37_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn c_StopServer(
|
||||
handle37_ptr: *mut ::std::os::raw::c_char,
|
||||
handle37_len: ::std::os::raw::c_int,
|
||||
handle38_ptr: *mut ::std::os::raw::c_char,
|
||||
handle38_len: ::std::os::raw::c_int,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
|
@ -624,8 +640,8 @@ extern "C" {
|
|||
}
|
||||
extern "C" {
|
||||
pub fn c_DeleteServer(
|
||||
handle38_ptr: *mut ::std::os::raw::c_char,
|
||||
handle38_len: ::std::os::raw::c_int,
|
||||
handle39_ptr: *mut ::std::os::raw::c_char,
|
||||
handle39_len: ::std::os::raw::c_int,
|
||||
password_ptr: *mut ::std::os::raw::c_char,
|
||||
password_len: ::std::os::raw::c_int,
|
||||
);
|
||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -4,7 +4,7 @@
|
|||
#![deny(missing_docs)]
|
||||
|
||||
use crate::event::{ConversationID, Event, FileKey, ProfileIdentity, ServerIdentity};
|
||||
use crate::structs::{MessageWrapper, Settings, SharedFile};
|
||||
use crate::structs::{ACL, MessageWrapper, Settings, SharedFile};
|
||||
|
||||
mod bindings_go;
|
||||
mod cwtchlib_go;
|
||||
|
@ -68,6 +68,12 @@ pub trait CwtchLib {
|
|||
/// starts a search process on a profile for pattern. returns a searchID that resulting SearchResult messages will have
|
||||
fn search_conversations(&self, profile: &ProfileIdentity, pattern: &str) -> String;
|
||||
|
||||
/// Get an ACL for a conversation
|
||||
fn get_conversation_access_control_list(&self, profile: &ProfileIdentity, conversation_id: ConversationID) -> Result<ACL, CwtchError>;
|
||||
|
||||
/// Update a conversation's ACL
|
||||
fn update_conversation_access_control_list(&self, profile: &ProfileIdentity, conversation_id: ConversationID, acl: ACL);
|
||||
|
||||
/// Get a specific message for a conversation by its id
|
||||
fn get_message_by_id(&self, profile: &ProfileIdentity, conversation_id: ConversationID, message_id: i32) -> String;
|
||||
|
||||
|
@ -80,7 +86,7 @@ pub trait CwtchLib {
|
|||
) -> String;
|
||||
|
||||
/// Bulk get messages starting at message index and of count amoung
|
||||
fn get_messages(&self, profile: &ProfileIdentity, conversation_id: ConversationID, message_index: i32, count: i32) -> String;
|
||||
fn get_messages(&self, profile: &ProfileIdentity, conversation_id: ConversationID, message_index: i32, count: u32) -> String;
|
||||
|
||||
/// Send json of a structs::Message from profile to contact. Returns computed sent message (including index and hash values)
|
||||
fn send_message_raw(&self, profile: &ProfileIdentity, conversation_id: ConversationID, msg: &str) -> String;
|
||||
|
|
|
@ -94,6 +94,18 @@ pub struct AccessControl {
|
|||
pub read: bool,
|
||||
/// Allows a handle to append new messages to the conversation
|
||||
pub append: bool,
|
||||
|
||||
/// Profile should automatically try to connect with peer
|
||||
pub auto_connect: bool,
|
||||
|
||||
/// Profile should automatically exchange attributes like Name, Profile Image, etc.
|
||||
pub exchange_attributes: bool,
|
||||
|
||||
/// Allows a handle to share files to a conversation
|
||||
pub share_files: bool,
|
||||
|
||||
/// Indicates that certain filetypes should be autodownloaded and rendered when shared by this contact
|
||||
pub render_images: bool
|
||||
}
|
||||
|
||||
/// represents an access control list for a conversation. Mapping handles to conversation functions
|
||||
|
|
Loading…
Reference in New Issue