diff --git a/src/mrmailbox.c b/src/mrmailbox.c index 86b3a246..57997e0c 100644 --- a/src/mrmailbox.c +++ b/src/mrmailbox.c @@ -3128,13 +3128,15 @@ cleanup: * NB: The "vcard" in the function name is just an abbreviation of "visiting card" and * is not related to the VCARD data format. * + * @memberof mrmailbox_t + * * @param mailbox The mailbox object. * * @param chat_id The chat to send the message to. * * @param contact_id The contact whichs data should be shared to the chat. * - * @param Returns the ID of the message sent. + * @return Returns the ID of the message sent. */ uint32_t mrmailbox_send_vcard_msg(mrmailbox_t* mailbox, uint32_t chat_id, uint32_t contact_id) { diff --git a/src/mrmsg.c b/src/mrmsg.c index c5bd0774..79e2cffb 100644 --- a/src/mrmsg.c +++ b/src/mrmsg.c @@ -424,12 +424,63 @@ cleanup: } +/** + * Get width of image or video. The width is returned in pixels. + * If the width is unknown or if the associated file is no image or video file, + * 0 is returned. + * + * Often the ascpect ratio is the more interesting thing. You can calculate + * this using mrmsg_get_width() / mrmsg_get_height(). + * + * See also mrmsg_get_duration(). + * + * @memberof mrmsg_t + * + * @param msg The message object. + * + * @return Width in pixels, if applicable. 0 otherwise or if unknown. + */ +int mrmsg_get_width(mrmsg_t* msg) +{ + if( msg == NULL ) { + return 0; + } + return mrparam_get_int(msg->m_param, MRP_WIDTH, 0); +} + /** - * Get duration of audios or videos. The duration is returned in milliseconds (ms). + * Get height of image or video. The height is returned in pixels. + * If the height is unknown or if the associated file is no image or video file, + * 0 is returned. + * + * Often the ascpect ratio is the more interesting thing. You can calculate + * this using mrmsg_get_width() / mrmsg_get_height(). + * + * See also mrmsg_get_duration(). + * + * @memberof mrmsg_t + * + * @param msg The message object. + * + * @return Height in pixels, if applicable. 0 otherwise or if unknown. + */ +int mrmsg_get_height(mrmsg_t* msg) +{ + if( msg == NULL ) { + return 0; + } + return mrparam_get_int(msg->m_param, MRP_HEIGHT, 0); +} + + +/** + * Get duration of audio or video. The duration is returned in milliseconds (ms). * If the duration is unknown or if the associated file is no audio or video file, * 0 is returned. * + * See also mrmsg_get_width() and mrmsg_get_height(). + * * @memberof mrmsg_t * * @param msg The message object. diff --git a/src/mrmsg.h b/src/mrmsg.h index bb524c6d..572b5d58 100644 --- a/src/mrmsg.h +++ b/src/mrmsg.h @@ -138,6 +138,8 @@ char* mrmsg_get_file (mrmsg_t*); char* mrmsg_get_filename (mrmsg_t*); char* mrmsg_get_filemime (mrmsg_t*); mrpoortext_t* mrmsg_get_mediainfo (mrmsg_t*); +int mrmsg_get_width (mrmsg_t*); +int mrmsg_get_height (mrmsg_t*); int mrmsg_get_duration (mrmsg_t*); int mrmsg_get_showpadlock (mrmsg_t*); mrpoortext_t* mrmsg_get_summary (mrmsg_t*, mrchat_t*);