text stringlengths 0 357 |
|---|
p = NULL; |
int e2ee_errors; |
if ((e2ee_errors=dc_param_get_int(msg->param, DC_PARAM_ERRONEOUS_E2EE, 0))) { |
if (e2ee_errors&DC_E2EE_NO_VALID_SIGNATURE) { |
p = dc_strdup("Encrypted, no valid signature"); |
} |
} |
else if (dc_param_get_int(msg->param, DC_PARAM_GUARANTEE_E2EE, 0)) { |
p = dc_strdup("Encrypted"); |
} |
if (p) { |
dc_strbuilder_catf(&ret, ", %s", p); |
free(p); |
} |
dc_strbuilder_cat(&ret, "\n"); |
if ((p=dc_param_get(msg->param, DC_PARAM_ERROR, NULL))!=NULL) { |
dc_strbuilder_catf(&ret, "Error: %s\n", p); |
free(p); |
} |
/* add file info */ |
if ((p=dc_msg_get_file(msg))!=NULL && p[0]) { |
dc_strbuilder_catf(&ret, "\nFile: %s, %i bytes\n", p, (int)dc_get_filebytes(context, p)); |
} |
free(p); |
if (msg->type!=DC_MSG_TEXT) { |
p = NULL; |
switch (msg->type) { |
case DC_MSG_AUDIO: p = dc_strdup("Audio"); break; |
case DC_MSG_FILE: p = dc_strdup("File"); break; |
case DC_MSG_GIF: p = dc_strdup("GIF"); break; |
case DC_MSG_IMAGE: p = dc_strdup("Image"); break; |
case DC_MSG_VIDEO: p = dc_strdup("Video"); break; |
case DC_MSG_VOICE: p = dc_strdup("Voice"); break; |
default: p = dc_mprintf("%i", msg->type); break; |
} |
dc_strbuilder_catf(&ret, "Type: %s\n", p); |
free(p); |
p = dc_msg_get_filemime(msg); |
dc_strbuilder_catf(&ret, "Mimetype: %s\n", p); |
free(p); |
} |
int w = dc_param_get_int(msg->param, DC_PARAM_WIDTH, 0); |
int h = dc_param_get_int(msg->param, DC_PARAM_HEIGHT, 0); |
if (w!=0 || h!=0) { |
p = dc_mprintf("Dimension: %i x %i\n", w, h); dc_strbuilder_cat(&ret, p); free(p); |
} |
int duration = dc_param_get_int(msg->param, DC_PARAM_DURATION, 0); |
if (duration!=0) { |
p = dc_mprintf("Duration: %i ms\n", duration); dc_strbuilder_cat(&ret, p); free(p); |
} |
/* add rawtext */ |
if (rawtxt && rawtxt[0]) { |
dc_strbuilder_cat(&ret, "\n"); |
dc_strbuilder_cat(&ret, rawtxt); |
dc_strbuilder_cat(&ret, "\n"); |
} |
/* add Message-ID, Server-Folder and Server-UID; the database ID is normally only of interest if you have access to sqlite; if so you can easily get it from the "msgs" table. */ |
if (msg->rfc724_mid && msg->rfc724_mid[0]) { |
dc_strbuilder_catf(&ret, "\nMessage-ID: %s", msg->rfc724_mid); |
} |
if (msg->server_folder && msg->server_folder[0]) { |
dc_strbuilder_catf(&ret, "\nLast seen as: %s/%i", msg->server_folder, (int)msg->server_uid); |
} |
cleanup: |
sqlite3_finalize(stmt); |
dc_msg_unref(msg); |
dc_contact_unref(contact_from); |
free(rawtxt); |
return ret.buf; |
} |
/** |
* Get the raw mime-headers of the given message. |
* Raw headers are saved for incoming messages |
* only if `dc_set_config(context, "save_mime_headers", "1")` |
* was called before. |
* |
* @memberof dc_context_t |
* @param context The context object as created by dc_context_new(). |
* @param msg_id The message id, must be the id of an incoming message. |
* @return Raw headers as a multi-line string, must be free()'d after usage. |
* Returns NULL if there are no headers saved for the given message, |
* eg. because of save_mime_headers is not set |
* or the message is not incoming. |
*/ |
char* dc_get_mime_headers(dc_context_t* context, uint32_t msg_id) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.