swap paramters in sendUpdate(); the 'descr' may be split up in the future, so it makes sense to have that at the end

This commit is contained in:
B. Petersen
2022-01-06 17:37:25 +01:00
committed by bjoern
parent 14e9afaf42
commit 8c2ea0fa26
5 changed files with 16 additions and 16 deletions

View File

@@ -987,7 +987,7 @@ uint32_t dc_send_videochat_invitation (dc_context_t* context, uint32_t chat_id);
*
* In js-land, that would be mapped to sth. as:
* ```
* success = window.webxdc.sendUpdate('move A3 B4', '{"action":"move","src":"A3","dest":"B4"}');
* success = window.webxdc.sendUpdate('{"action":"move","src":"A3","dest":"B4"}', 'move A3 B4');
* ```
* `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.
@@ -1004,12 +1004,12 @@ uint32_t dc_send_videochat_invitation (dc_context_t* context, uint32_t chat_id);
* @memberof dc_context_t
* @param context The context object
* @param msg_id id of the message with the webxdc instance
* @param json program-readable data, the actual payload
* @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_webxdc_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* json, const char* descr);
/**

View File

@@ -881,8 +881,8 @@ pub unsafe extern "C" fn dc_send_videochat_invitation(
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,
descr: *const libc::c_char,
) -> libc::c_int {
if context.is_null() {
eprintln!("ignoring careless call to dc_send_webxdc_status_update()");
@@ -892,8 +892,8 @@ pub unsafe extern "C" fn dc_send_webxdc_status_update(
block_on(ctx.send_webxdc_status_update(
MsgId::new(msg_id),
&to_string_lossy(descr),
&to_string_lossy(json),
&to_string_lossy(descr),
))
.log_err(ctx, "Failed to send webxdc update")
.is_ok() as libc::c_int