From 5becb41bd4b26674d28ed5979b7d329049d1d857 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Tue, 15 Aug 2023 14:51:14 -0700 Subject: [PATCH] pass hook_id instead of url --- controller/PostgreSQL.cpp | 4 +--- rustybits/smeeclient/src/ext.rs | 10 +++++----- rustybits/smeeclient/src/lib.rs | 8 ++++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp index 05b900395..878c646b3 100644 --- a/controller/PostgreSQL.cpp +++ b/controller/PostgreSQL.cpp @@ -1672,8 +1672,6 @@ void PostgreSQL::commitThread() } void PostgreSQL::notifyNewMember(const std::string &networkID, const std::string &memberID) { - // TODO: Look up hook URL for network owner organization - std::shared_ptr c; try { c = _pool->borrow(); @@ -1687,7 +1685,7 @@ void PostgreSQL::notifyNewMember(const std::string &networkID, const std::string // TODO: Add check for active subscription - auto res = w.exec_params("SELECT h.hook_url " + auto res = w.exec_params("SELECT h.hook_id " "FROM ztc_hook h " "INNER JOIN ztc_hook_hook_types ht " "ON ht.hook_id = h.hook_id " diff --git a/rustybits/smeeclient/src/ext.rs b/rustybits/smeeclient/src/ext.rs index 9a5e5a60e..017bb6dfa 100644 --- a/rustybits/smeeclient/src/ext.rs +++ b/rustybits/smeeclient/src/ext.rs @@ -64,7 +64,7 @@ pub extern "C" fn smee_client_notify_network_joined( smee_instance: *mut SmeeClient, network_id: *const c_char, member_id: *const c_char, - hook_url: *const c_char, + hook_id: *const c_char, src_ip: *const c_char, ) -> bool { let nwid = unsafe { @@ -77,9 +77,9 @@ pub extern "C" fn smee_client_notify_network_joined( CStr::from_ptr(member_id).to_str().unwrap() }; - let url = unsafe { - assert!(!hook_url.is_null()); - CStr::from_ptr(hook_url).to_str().unwrap() + let hid = unsafe { + assert!(!hook_id.is_null()); + CStr::from_ptr(hook_id).to_str().unwrap() }; let src = unsafe { @@ -95,7 +95,7 @@ pub extern "C" fn smee_client_notify_network_joined( &mut *smee_instance }; - let params = NetworkJoinedParams::new(nwid, mem_id, url, src); + let params = NetworkJoinedParams::new(nwid, mem_id, hid, src); match smee.notify_network_joined(params) { Ok(()) => true, diff --git a/rustybits/smeeclient/src/lib.rs b/rustybits/smeeclient/src/lib.rs index 4b97c4494..c3f89c063 100644 --- a/rustybits/smeeclient/src/lib.rs +++ b/rustybits/smeeclient/src/lib.rs @@ -32,19 +32,19 @@ pub struct NetworkJoinedParams { #[serde(rename = "MemberID")] pub member_id: String, - #[serde(rename = "HookURL")] - pub hook_url: String, + #[serde(rename = "HookID")] + pub hook_id: String, #[serde(rename = "SrcIP")] pub src_ip: Option, } impl NetworkJoinedParams { - fn new(network_id: &str, member_id: &str, hook_url: &str, src_ip: Option<&str>) -> Self { + fn new(network_id: &str, member_id: &str, hook_id: &str, src_ip: Option<&str>) -> Self { Self { network_id: network_id.to_string(), member_id: member_id.to_string(), - hook_url: hook_url.to_string(), + hook_id: hook_id.to_string(), src_ip: match src_ip { Some(x) => Some(x.to_string()), None => None,