mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 08:56:30 +03:00
rename w30 to webxdc
This commit is contained in:
@@ -983,39 +983,39 @@ uint32_t dc_send_videochat_invitation (dc_context_t* context, uint32_t chat_id);
|
||||
|
||||
|
||||
/**
|
||||
* An w30 instance send a status update to its other members.
|
||||
* An webxdc instance send a status update to its other members.
|
||||
*
|
||||
* In js-land, that would be mapped to sth. as:
|
||||
* ```
|
||||
* success = window.webxdc.sendUpdate('move A3 B4', '{"action":"move","src":"A3","dest":"B4"}');
|
||||
* ```
|
||||
* `context` and `msg_id` is not needed in js as that is unique within an w30 instance.
|
||||
* See dc_get_w30_status_updates() for the receiving counterpart.
|
||||
* `context` and `msg_id` is not needed in js as that is unique within an webxdc instance.
|
||||
* See dc_get_webxdc_status_updates() for the receiving counterpart.
|
||||
*
|
||||
* If the w30 instance is a draft, the update is not send immediately.
|
||||
* If the webxdc instance is a draft, the update is not send immediately.
|
||||
* Instead, the updates are collected and sent out in batch when the instance is actually sent.
|
||||
* This allows preparing w30 instances,
|
||||
* This allows preparing webxdc instances,
|
||||
* eg. defining a poll with predefined answers.
|
||||
*
|
||||
* Other members will be informed by #DC_EVENT_W30_STATUS_UPDATE that there is a new update.
|
||||
* You will also get the #DC_EVENT_W30_STATUS_UPDATE yourself
|
||||
* and the update you're sent will also be included in dc_get_w30_status_updates().
|
||||
* Other members will be informed by #DC_EVENT_WEBXDC_STATUS_UPDATE that there is a new update.
|
||||
* You will also get the #DC_EVENT_WEBXDC_STATUS_UPDATE yourself
|
||||
* and the update you're sent will also be included in dc_get_webxdc_status_updates().
|
||||
*
|
||||
* @memberof dc_context_t
|
||||
* @param context The context object
|
||||
* @param msg_id id of the message with the w30 instance
|
||||
* @param msg_id id of the message with the webxdc instance
|
||||
* @param descr user-visible description of the json-data,
|
||||
* in case of a chess game, eg. the move.
|
||||
* @param json program-readable data, the actual payload
|
||||
* @return 1=success, 0=error
|
||||
*/
|
||||
int dc_send_w30_status_update (dc_context_t* context, uint32_t msg_id, const char* descr, const char* json);
|
||||
int dc_send_webxdc_status_update (dc_context_t* context, uint32_t msg_id, const char* descr, const char* json);
|
||||
|
||||
|
||||
/**
|
||||
* Get status updates.
|
||||
* The status updates may be sent by yourself or by other members using dc_send_w30_status_update().
|
||||
* In both cases, you will be informed by #DC_EVENT_W30_STATUS_UPDATE
|
||||
* The status updates may be sent by yourself or by other members using dc_send_webxdc_status_update().
|
||||
* In both cases, you will be informed by #DC_EVENT_WEBXDC_STATUS_UPDATE
|
||||
* whenever there is a new update.
|
||||
*
|
||||
* In js-land, that would be mapped to sth. as:
|
||||
@@ -1030,15 +1030,15 @@ int dc_send_w30_status_update (dc_context_t* context, uint32_t msg_id, const cha
|
||||
*
|
||||
* @memberof dc_context_t
|
||||
* @param context The context object
|
||||
* @param msg_id id of the message with the w30 instance
|
||||
* @param msg_id id of the message with the webxdc instance
|
||||
* @param status_update_id Can be used to filter out only a concrete status update.
|
||||
* When set to 0, all known status updates are returned.
|
||||
* @return JSON-array containing the requested updates,
|
||||
* each element was created by dc_send_w30_status_update()
|
||||
* each element was created by dc_send_webxdc_status_update()
|
||||
* on this or other devices.
|
||||
* If there are no updates, an empty JSON-array is returned.
|
||||
*/
|
||||
char* dc_get_w30_status_updates (dc_context_t* context, uint32_t msg_id, uint32_t status_update_id);
|
||||
char* dc_get_webxdc_status_updates (dc_context_t* context, uint32_t msg_id, uint32_t status_update_id);
|
||||
|
||||
/**
|
||||
* Save a draft for a chat in the database.
|
||||
@@ -3676,17 +3676,17 @@ char* dc_msg_get_filemime (const dc_msg_t* msg);
|
||||
|
||||
|
||||
/**
|
||||
* Return file from inside an archive.
|
||||
* Currently, this works for W30 messages only.
|
||||
* Return file from inside an webxdc message.
|
||||
*
|
||||
* @param msg The W30 instance.
|
||||
* @memberof dc_msg_t
|
||||
* @param msg The webxdc instance.
|
||||
* @param filename The name inside the archive,
|
||||
* must be given as a relative path (no leading `/`).
|
||||
* @param ret_bytes Pointer to a size_t. The size of the blob will be written here.
|
||||
* @return The blob must be released using dc_str_unref() after usage.
|
||||
* NULL if there is no such file in the archive or on errors.
|
||||
*/
|
||||
char* dc_msg_get_blob_from_archive (const dc_msg_t* msg, const char* filename, size_t* ret_bytes);
|
||||
char* dc_msg_get_webxdc_blob (const dc_msg_t* msg, const char* filename, size_t* ret_bytes);
|
||||
|
||||
|
||||
/**
|
||||
@@ -4848,12 +4848,12 @@ int64_t dc_lot_get_timestamp (const dc_lot_t* lot);
|
||||
|
||||
|
||||
/**
|
||||
* w30-Message.
|
||||
* webxdc-Message.
|
||||
* Message with HTML5, CSS and related content.
|
||||
*
|
||||
* To send data to a w30 instance, use dc_send_w30_status_update()
|
||||
* To send data to a webxdc instance, use dc_send_webxdc_status_update()
|
||||
*/
|
||||
#define DC_MSG_W30 80
|
||||
#define DC_MSG_WEBXDC 80
|
||||
|
||||
|
||||
/**
|
||||
@@ -5550,18 +5550,18 @@ void dc_event_unref(dc_event_t* event);
|
||||
|
||||
|
||||
/**
|
||||
* w30 status update received.
|
||||
* To get the received status update, use dc_get_w30_status_updates().
|
||||
* To send status updates, use dc_send_w30_status_update().
|
||||
* webxdc status update received.
|
||||
* To get the received status update, use dc_get_webxdc_status_updates().
|
||||
* To send status updates, use dc_send_webxdc_status_update().
|
||||
*
|
||||
* Note, that you do not get events that arrive when the app is not running;
|
||||
* instead, you can use dc_get_w30_status_updates() to get all status updates
|
||||
* instead, you can use dc_get_webxdc_status_updates() to get all status updates
|
||||
* and catch up that way.
|
||||
*
|
||||
* @param data1 (int) msg_id
|
||||
* @param data2 (int) status_update_id
|
||||
*/
|
||||
#define DC_EVENT_W30_STATUS_UPDATE 2120
|
||||
#define DC_EVENT_WEBXDC_STATUS_UPDATE 2120
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,7 +37,7 @@ use deltachat::ephemeral::Timer as EphemeralTimer;
|
||||
use deltachat::key::DcKey;
|
||||
use deltachat::message::MsgId;
|
||||
use deltachat::stock_str::StockMessage;
|
||||
use deltachat::w30::StatusUpdateId;
|
||||
use deltachat::webxdc::StatusUpdateId;
|
||||
use deltachat::*;
|
||||
use deltachat::{accounts::Accounts, log::LogExt};
|
||||
|
||||
@@ -501,7 +501,7 @@ pub unsafe extern "C" fn dc_event_get_data1_int(event: *mut dc_event_t) -> libc:
|
||||
EventType::ImexFileWritten(_) => 0,
|
||||
EventType::SecurejoinInviterProgress { contact_id, .. }
|
||||
| EventType::SecurejoinJoinerProgress { contact_id, .. } => *contact_id as libc::c_int,
|
||||
EventType::W30StatusUpdate { msg_id, .. } => msg_id.to_u32() as libc::c_int,
|
||||
EventType::WebxdcStatusUpdate { msg_id, .. } => msg_id.to_u32() as libc::c_int,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,7 +543,7 @@ pub unsafe extern "C" fn dc_event_get_data2_int(event: *mut dc_event_t) -> libc:
|
||||
EventType::SecurejoinInviterProgress { progress, .. }
|
||||
| EventType::SecurejoinJoinerProgress { progress, .. } => *progress as libc::c_int,
|
||||
EventType::ChatEphemeralTimerModified { timer, .. } => timer.to_u32() as libc::c_int,
|
||||
EventType::W30StatusUpdate {
|
||||
EventType::WebxdcStatusUpdate {
|
||||
status_update_id, ..
|
||||
} => status_update_id.to_u32() as libc::c_int,
|
||||
}
|
||||
@@ -587,7 +587,7 @@ pub unsafe extern "C" fn dc_event_get_data2_str(event: *mut dc_event_t) -> *mut
|
||||
| EventType::SecurejoinJoinerProgress { .. }
|
||||
| EventType::ConnectivityChanged
|
||||
| EventType::SelfavatarChanged
|
||||
| EventType::W30StatusUpdate { .. }
|
||||
| EventType::WebxdcStatusUpdate { .. }
|
||||
| EventType::ChatEphemeralTimerModified { .. } => ptr::null_mut(),
|
||||
EventType::ConfigureProgress { comment, .. } => {
|
||||
if let Some(comment) = comment {
|
||||
@@ -878,40 +878,40 @@ pub unsafe extern "C" fn dc_send_videochat_invitation(
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_send_w30_status_update(
|
||||
pub unsafe extern "C" fn dc_send_webxdc_status_update(
|
||||
context: *mut dc_context_t,
|
||||
msg_id: u32,
|
||||
descr: *const libc::c_char,
|
||||
json: *const libc::c_char,
|
||||
) -> libc::c_int {
|
||||
if context.is_null() {
|
||||
eprintln!("ignoring careless call to dc_send_w30_status_update()");
|
||||
eprintln!("ignoring careless call to dc_send_webxdc_status_update()");
|
||||
return 0;
|
||||
}
|
||||
let ctx = &*context;
|
||||
|
||||
block_on(ctx.send_w30_status_update(
|
||||
block_on(ctx.send_webxdc_status_update(
|
||||
MsgId::new(msg_id),
|
||||
&to_string_lossy(descr),
|
||||
&to_string_lossy(json),
|
||||
))
|
||||
.log_err(ctx, "Failed to send w30 update")
|
||||
.log_err(ctx, "Failed to send webxdc update")
|
||||
.is_ok() as libc::c_int
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_get_w30_status_updates(
|
||||
pub unsafe extern "C" fn dc_get_webxdc_status_updates(
|
||||
context: *mut dc_context_t,
|
||||
msg_id: u32,
|
||||
status_update_id: u32,
|
||||
) -> *mut libc::c_char {
|
||||
if context.is_null() {
|
||||
eprintln!("ignoring careless call to dc_get_w30_status_updates()");
|
||||
eprintln!("ignoring careless call to dc_get_webxdc_status_updates()");
|
||||
return "".strdup();
|
||||
}
|
||||
let ctx = &*context;
|
||||
|
||||
block_on(ctx.get_w30_status_updates(
|
||||
block_on(ctx.get_webxdc_status_updates(
|
||||
MsgId::new(msg_id),
|
||||
if status_update_id == 0 {
|
||||
None
|
||||
@@ -3071,13 +3071,13 @@ pub unsafe extern "C" fn dc_msg_get_filename(msg: *mut dc_msg_t) -> *mut libc::c
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_msg_get_blob_from_archive(
|
||||
pub unsafe extern "C" fn dc_msg_get_webxdc_blob(
|
||||
msg: *mut dc_msg_t,
|
||||
filename: *const libc::c_char,
|
||||
ret_bytes: *mut libc::size_t,
|
||||
) -> *mut libc::c_char {
|
||||
if msg.is_null() || filename.is_null() || ret_bytes.is_null() {
|
||||
eprintln!("ignoring careless call to dc_msg_get_blob_from_archive()");
|
||||
eprintln!("ignoring careless call to dc_msg_get_webxdc_blob()");
|
||||
return ptr::null_mut();
|
||||
}
|
||||
let ffi_msg = &*msg;
|
||||
@@ -3085,7 +3085,7 @@ pub unsafe extern "C" fn dc_msg_get_blob_from_archive(
|
||||
let blob = block_on(async move {
|
||||
ffi_msg
|
||||
.message
|
||||
.get_blob_from_archive(ctx, &to_string_lossy(filename))
|
||||
.get_webxdc_blob(ctx, &to_string_lossy(filename))
|
||||
.await
|
||||
});
|
||||
match blob {
|
||||
|
||||
Reference in New Issue
Block a user