mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 19:06:35 +03:00
change api interface
This commit is contained in:
@@ -1085,11 +1085,12 @@ char* dc_get_webxdc_status_updates (dc_context_t* context, uint32_t msg_id, uint
|
||||
|
||||
/**
|
||||
* List all webxdc that have updates in the queue
|
||||
*
|
||||
* @return An array containing all the msg ids
|
||||
* @param context The context object.
|
||||
* @param msg_id The ID of the message with the webxdc instance.
|
||||
* @return 1=contact ID is member of chat ID, 0=contact is not in chat
|
||||
*
|
||||
*/
|
||||
dc_array_t* dc_get_updating_webxdc ();
|
||||
int dc_get_updating_webxdc (dc_context_t* context, uint32_t chat_id);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -3303,24 +3303,22 @@ pub unsafe extern "C" fn dc_msg_get_webxdc_info(msg: *mut dc_msg_t) -> *mut libc
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_get_updating_webxdc(
|
||||
pub unsafe extern "C" fn dc_is_webxdc_updating(
|
||||
context: *mut dc_context_t,
|
||||
) -> *mut dc_array::dc_array_t {
|
||||
msg_id: u32,
|
||||
) -> libc::c_int {
|
||||
if context.is_null() {
|
||||
eprintln!("ignoring careless call to dc_get_blocked_contacts()");
|
||||
return ptr::null_mut();
|
||||
return 0;
|
||||
}
|
||||
let ctx = &*context;
|
||||
|
||||
let arr: Vec<MsgId> = block_on(async move {
|
||||
block_on(async move {
|
||||
webxdc::get_busy_webxdc_instances(ctx)
|
||||
.await
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.collect()
|
||||
});
|
||||
|
||||
Box::into_raw(Box::new(dc_array_t::from(arr)))
|
||||
.contains(&MsgId::new(msg_id)) as libc::c_int
|
||||
})
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
@@ -21,7 +21,6 @@ use crate::mimeparser::SystemMessage;
|
||||
use crate::param::Param;
|
||||
use crate::param::Params;
|
||||
use crate::scheduler::InterruptInfo;
|
||||
use crate::sql::Sql;
|
||||
use crate::tools::{create_smeared_timestamp, get_abs_path};
|
||||
use crate::{chat, EventType};
|
||||
|
||||
@@ -422,7 +421,7 @@ impl Context {
|
||||
|
||||
/// Attempts to send queued webxdc status updates.
|
||||
pub(crate) async fn flush_status_updates(&self) -> Result<()> {
|
||||
let update_needed = get_busy_webxdc_instances(&self).await?;
|
||||
let update_needed = get_busy_webxdc_instances(self).await?;
|
||||
|
||||
while let Some((instance_id, first_serial, last_serial, descr)) =
|
||||
self.pop_smtp_status_update().await?
|
||||
@@ -448,7 +447,7 @@ impl Context {
|
||||
chat::send_msg(self, instance.chat_id, &mut status_update).await?;
|
||||
}
|
||||
}
|
||||
let update_needed_after_sending = get_busy_webxdc_instances(&self).await?;
|
||||
let update_needed_after_sending = get_busy_webxdc_instances(self).await?;
|
||||
for msg_id in update_needed.difference(&update_needed_after_sending) {
|
||||
self.emit_event(EventType::WebxdcUpToDate { msg_id: *msg_id })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user