mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 09:56:31 +03:00
return correct videochat-type
This commit is contained in:
@@ -3291,11 +3291,11 @@ char* dc_msg_get_videochat_url (const dc_msg_t* msg);
|
||||
|
||||
|
||||
/**
|
||||
* Check if the videochat is a "basic webrtc" videochat.
|
||||
* Get type of videochat.
|
||||
*
|
||||
* Calling this functions only makes sense for messages of type #DC_MSG_VIDEOCHAT_INVITATION,
|
||||
* in this case, if "basic webrtc" as of https://github.com/cracker0dks/basicwebrtc was used to initiate the videochat,
|
||||
* dc_msg_is_basic_videochat() returns true.
|
||||
* dc_msg_get_videochat_type() returns DC_VIDEOCHATTYPE_BASICWEBRTC.
|
||||
* "basic webrtc" videochat may be processed natively by the app
|
||||
* whereas for other urls just the browser is opened.
|
||||
*
|
||||
@@ -3303,13 +3303,12 @@ char* dc_msg_get_videochat_url (const dc_msg_t* msg);
|
||||
* To check if a message is a videochat invitation at all, check the message type for #DC_MSG_VIDEOCHAT_INVITATION.
|
||||
*
|
||||
* @param msg The message object.
|
||||
* @return 0=message is no "basic webrtc" videochat invitation
|
||||
* 1=message is a "basic webrtc" videochat invitation.
|
||||
* @return Type of the videochat as of DC_VIDEOCHATTYPE_BASICWEBRTC or DC_VIDEOCHATTYPE_UNKNOWN.
|
||||
*
|
||||
* Example:
|
||||
* ~~~
|
||||
* if (dc_msg_get_viewtype(msg) == DC_MSG_VIDEOCHAT_INVITATION) {
|
||||
* if (dc_msg_is_basic_videochat(msg)) {
|
||||
* if (dc_msg_get_videochat_type(msg) == DC_VIDEOCHATTYPE_BASICWEBRTC) {
|
||||
* // videochat invitation that we ship a client for
|
||||
* } else {
|
||||
* // use browser for videochat, just open the url
|
||||
@@ -3319,7 +3318,10 @@ char* dc_msg_get_videochat_url (const dc_msg_t* msg);
|
||||
* }
|
||||
* ~~~
|
||||
*/
|
||||
int dc_msg_is_basic_videochat (const dc_msg_t* msg);
|
||||
int dc_msg_get_videochat_type (const dc_msg_t* msg);
|
||||
|
||||
#define DC_VIDEOCHATTYPE_UNKNOWN 0
|
||||
#define DC_VIDEOCHATTYPE_BASICWEBRTC 1
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -2847,19 +2847,21 @@ pub unsafe extern "C" fn dc_msg_get_videochat_url(msg: *mut dc_msg_t) -> *mut li
|
||||
}
|
||||
let ffi_msg = &*msg;
|
||||
|
||||
block_on(ffi_msg.message.get_videochat_url())
|
||||
ffi_msg
|
||||
.message
|
||||
.get_videochat_url()
|
||||
.unwrap_or_default()
|
||||
.strdup()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_msg_is_basic_videochat(msg: *mut dc_msg_t) -> libc::c_int {
|
||||
pub unsafe extern "C" fn dc_msg_get_videochat_type(msg: *mut dc_msg_t) -> libc::c_int {
|
||||
if msg.is_null() {
|
||||
eprintln!("ignoring careless call to dc_msg_is_basic_videochat()");
|
||||
eprintln!("ignoring careless call to dc_msg_get_videochat_type()");
|
||||
return 0;
|
||||
}
|
||||
let ffi_msg = &*msg;
|
||||
ffi_msg.message.is_basic_videochat().into()
|
||||
ffi_msg.message.get_videochat_type().unwrap_or_default() as i32
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
Reference in New Issue
Block a user