diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index 339bc0f12..9d1d32fea 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -17,7 +17,6 @@ typedef struct _dc_array dc_array_t; typedef struct _dc_chatlist dc_chatlist_t; typedef struct _dc_chat dc_chat_t; typedef struct _dc_msg dc_msg_t; -typedef struct _dc_reactions dc_reactions_t; typedef struct _dc_contact dc_contact_t; typedef struct _dc_lot dc_lot_t; typedef struct _dc_provider dc_provider_t; @@ -1117,36 +1116,6 @@ uint32_t dc_send_text_msg (dc_context_t* context, uint32_t ch uint32_t dc_send_videochat_invitation (dc_context_t* context, uint32_t chat_id); -/** - * Send a reaction to message. - * - * Reaction is a string of emojis separated by spaces. Reaction to a - * single message can be sent multiple times. The last reaction - * received overrides all previously received reactions. It is - * possible to remove all reactions by sending an empty string. - * - * @deprecated 2023-11-27, use jsonrpc method `send_reaction` instead - * @memberof dc_context_t - * @param context The context object. - * @param msg_id ID of the message you react to. - * @param reaction A string consisting of emojis separated by spaces. - * @return The ID of the message sent out or 0 for errors. - */ -uint32_t dc_send_reaction (dc_context_t* context, uint32_t msg_id, char *reaction); - - -/** - * Get a structure with reactions to the message. - * - * @deprecated 2023-11-27, use jsonrpc method `get_message_reactions` instead - * @memberof dc_context_t - * @param context The context object. - * @param msg_id The message ID to get reactions for. - * @return A structure with all reactions to the message. - */ -dc_reactions_t* dc_get_msg_reactions (dc_context_t *context, int msg_id); - - /** * A webxdc instance sends a status update to its other members. * @@ -5320,52 +5289,6 @@ uint32_t dc_lot_get_id (const dc_lot_t* lot); int64_t dc_lot_get_timestamp (const dc_lot_t* lot); -/** - * @class dc_reactions_t - * @deprecated 2023-11-27, use jsonrpc method `get_message_reactions` instead - * - * An object representing all reactions for a single message. - */ - -/** - * Returns array of contacts which reacted to the given message. - * - * @deprecated 2023-11-27, use jsonrpc method `get_message_reactions` instead - * @memberof dc_reactions_t - * @param reactions The object containing message reactions. - * @return array of contact IDs. Use dc_array_get_cnt() to get array length and - * dc_array_get_id() to get the IDs. Should be freed using `dc_array_unref()` after usage. - */ -dc_array_t* dc_reactions_get_contacts(dc_reactions_t* reactions); - - -/** - * Returns a string containing space-separated reactions of a single contact. - * - * @deprecated 2023-11-27, use jsonrpc method `get_message_reactions` instead - * @memberof dc_reactions_t - * @param reactions The object containing message reactions. - * @param contact_id ID of the contact. - * @return Space-separated list of emoji sequences, which could be empty. - * Returned string should not be modified and should be freed - * with dc_str_unref() after usage. - */ -char* dc_reactions_get_by_contact_id(dc_reactions_t* reactions, uint32_t contact_id); - - -/** - * Frees an object containing message reactions. - * - * Reactions objects are created by dc_get_msg_reactions(). - * - * @deprecated 2023-11-27 - * @memberof dc_reactions_t - * @param reactions The object to free. - * If NULL is given, nothing is done. - */ -void dc_reactions_unref (dc_reactions_t* reactions); - - /** * @defgroup DC_MSG DC_MSG * diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 702329310..88dc3819d 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -32,7 +32,6 @@ use deltachat::imex::BackupProvider; use deltachat::key::preconfigure_keypair; use deltachat::message::MsgId; use deltachat::qr_code_generator::{generate_backup_qr, get_securejoin_qr_svg}; -use deltachat::reaction::{get_msg_reactions, send_reaction, Reactions}; use deltachat::stock_str::StockMessage; use deltachat::webxdc::StatusUpdateSerial; use deltachat::*; @@ -68,8 +67,6 @@ const DC_GCM_INFO_ONLY: u32 = 0x02; /// Struct representing the deltachat context. pub type dc_context_t = Context; -pub type dc_reactions_t = Reactions; - static RT: Lazy = Lazy::new(|| Runtime::new().expect("unable to create tokio runtime")); fn block_on(fut: T) -> T::Output @@ -1015,49 +1012,6 @@ pub unsafe extern "C" fn dc_send_videochat_invitation( }) } -#[no_mangle] -pub unsafe extern "C" fn dc_send_reaction( - context: *mut dc_context_t, - msg_id: u32, - reaction: *const libc::c_char, -) -> u32 { - if context.is_null() { - eprintln!("ignoring careless call to dc_send_reaction()"); - return 0; - } - let ctx = &*context; - - block_on(async move { - send_reaction(ctx, MsgId::new(msg_id), &to_string_lossy(reaction)) - .await - .map(|msg_id| msg_id.to_u32()) - .unwrap_or_log_default(ctx, "Failed to send reaction") - }) -} - -#[no_mangle] -pub unsafe extern "C" fn dc_get_msg_reactions( - context: *mut dc_context_t, - msg_id: u32, -) -> *mut dc_reactions_t { - if context.is_null() { - eprintln!("ignoring careless call to dc_get_msg_reactions()"); - return ptr::null_mut(); - } - let ctx = &*context; - - let reactions = if let Ok(reactions) = block_on(get_msg_reactions(ctx, MsgId::new(msg_id))) - .context("failed dc_get_msg_reactions() call") - .log_err(ctx) - { - reactions - } else { - return ptr::null_mut(); - }; - - Box::into_raw(Box::new(reactions)) -} - #[no_mangle] pub unsafe extern "C" fn dc_send_webxdc_status_update( context: *mut dc_context_t, @@ -4244,45 +4198,6 @@ pub unsafe extern "C" fn dc_lot_get_timestamp(lot: *mut dc_lot_t) -> i64 { lot.get_timestamp() } -#[no_mangle] -pub unsafe extern "C" fn dc_reactions_get_contacts( - reactions: *mut dc_reactions_t, -) -> *mut dc_array::dc_array_t { - if reactions.is_null() { - eprintln!("ignoring careless call to dc_reactions_get_contacts()"); - return ptr::null_mut(); - } - - let reactions = &*reactions; - let array: dc_array_t = reactions.contacts().into(); - - Box::into_raw(Box::new(array)) -} - -#[no_mangle] -pub unsafe extern "C" fn dc_reactions_get_by_contact_id( - reactions: *mut dc_reactions_t, - contact_id: u32, -) -> *mut libc::c_char { - if reactions.is_null() { - eprintln!("ignoring careless call to dc_reactions_get_by_contact_id()"); - return ptr::null_mut(); - } - - let reactions = &*reactions; - reactions.get(ContactId::new(contact_id)).as_str().strdup() -} - -#[no_mangle] -pub unsafe extern "C" fn dc_reactions_unref(reactions: *mut dc_reactions_t) { - if reactions.is_null() { - eprintln!("ignoring careless call to dc_reactions_unref()"); - return; - } - - drop(Box::from_raw(reactions)); -} - #[no_mangle] pub unsafe extern "C" fn dc_str_unref(s: *mut libc::c_char) { libc::free(s as *mut _)