text
stringlengths
0
357
* this must be the full path of the image file to send.
* @param filemime Mime type of the file. NULL if you don't know or don't care.
* @return None.
*/
void dc_msg_set_file(dc_msg_t* msg, const char* file, const char* filemime)
{
if (msg==NULL || msg->magic!=DC_MSG_MAGIC) {
return;
}
dc_param_set(msg->param, DC_PARAM_FILE, file);
dc_param_set(msg->param, DC_PARAM_MIMETYPE, filemime);
}
/**
* Set the dimensions associated with message object.
* Typically this is the width and the height of an image or video associated using dc_msg_set_file().
* This does not alter any information in the database; this may be done by dc_send_msg() later.
*
* @memberof dc_msg_t
* @param msg The message object.
* @param width Width in pixels, if known. 0 if you don't know or don't care.
* @param height Height in pixels, if known. 0 if you don't know or don't care.
* @return None.
*/
void dc_msg_set_dimension(dc_msg_t* msg, int width, int height)
{
if (msg==NULL || msg->magic!=DC_MSG_MAGIC) {
return;
}
dc_param_set_int(msg->param, DC_PARAM_WIDTH, width);
dc_param_set_int(msg->param, DC_PARAM_HEIGHT, height);
}
/**
* Set the duration associated with message object.
* Typically this is the duration of an audio or video associated using dc_msg_set_file().
* This does not alter any information in the database; this may be done by dc_send_msg() later.
*
* @memberof dc_msg_t
* @param msg The message object.
* @param duration Length in milliseconds. 0 if you don't know or don't care.
* @return None.
*/
void dc_msg_set_duration(dc_msg_t* msg, int duration)
{
if (msg==NULL || msg->magic!=DC_MSG_MAGIC) {
return;
}
dc_param_set_int(msg->param, DC_PARAM_DURATION, duration);
}
/**
* Set any location that should be bound to the message object.
* The function is useful to add a marker to the map
* at a position different from the self-location.
* You should not call this function
* if you want to bind the current self-location to a message;
* this is done by dc_set_location() and dc_send_locations_to_chat().
*
* Typically results in the event #DC_EVENT_LOCATION_CHANGED with
* contact_id set to DC_CONTACT_ID_SELF.
*
* @memberof dc_msg_t
* @param msg The message object.
* @param latitude North-south position of the location.
* @param longitude East-west position of the location.
* @return None.
*/
void dc_msg_set_location(dc_msg_t* msg, double latitude, double longitude)
{
if (msg==NULL || msg->magic!=DC_MSG_MAGIC || (latitude==0.0 && longitude==0.0)) {
return;
}
dc_param_set_float(msg->param, DC_PARAM_SET_LATITUDE, latitude);
dc_param_set_float(msg->param, DC_PARAM_SET_LONGITUDE, longitude);
}
/**
* Late filing information to a message.
* In contrast to the dc_msg_set_*() functions, this function really stores the information in the database.
*
* Sometimes, the core cannot find out the width, the height or the duration
* of an image, an audio or a video.
*
* If, in these cases, the frontend can provide the information, it can save
* them together with the message object for later usage.
*
* This function should only be used if dc_msg_get_width(), dc_msg_get_height() or dc_msg_get_duration()
* do not provide the expected values.
*
* To get the stored values later, use dc_msg_get_width(), dc_msg_get_height() or dc_msg_get_duration().
*
* @memberof dc_msg_t
* @param msg The message object.
* @param width The new width to store in the message object. 0 if you do not want to change width and height.