1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-05 02:29:28 +02:00

refactor constants, rest

This commit is contained in:
B. Petersen 2018-06-25 23:23:18 +02:00
parent 2194803624
commit ad788ac3d0
56 changed files with 594 additions and 596 deletions

View file

@ -148,7 +148,7 @@ static int poke_public_key(dc_context_t* mailbox, const char* addr, const char*
}
/* create a fake autocrypt header */
header->m_addr = safe_strdup(addr);
header->m_addr = dc_strdup(addr);
header->m_prefer_encrypt = DC_PE_MUTUAL;
if( !dc_key_set_from_file(header->m_public_key, public_key_file, mailbox)
|| !dc_pgp_is_valid_key(mailbox, header->m_public_key) ) {
@ -214,7 +214,7 @@ static int poke_spec(dc_context_t* mailbox, const char* spec)
/* if `spec` is given, remember it for later usage; if it is not given, try to use the last one */
if( spec )
{
real_spec = safe_strdup(spec);
real_spec = dc_strdup(spec);
dc_sqlite3_lock(mailbox->m_sql);
dc_sqlite3_set_config__(mailbox->m_sql, "import_spec", real_spec);
dc_sqlite3_unlock(mailbox->m_sql);
@ -357,10 +357,10 @@ static void log_contactlist(dc_context_t* mailbox, dc_array_t* contacts)
if( peerstate_ok && contact_id != DC_CONTACT_ID_SELF ) {
char* pe = NULL;
switch( peerstate->m_prefer_encrypt ) {
case DC_PE_MUTUAL: pe = safe_strdup("mutual"); break;
case DC_PE_NOPREFERENCE: pe = safe_strdup("no-preference"); break;
case DC_PE_RESET: pe = safe_strdup("reset"); break;
default: pe = dc_mprintf("unknown-value (%i)", peerstate->m_prefer_encrypt); break;
case DC_PE_MUTUAL: pe = dc_strdup("mutual"); break;
case DC_PE_NOPREFERENCE: pe = dc_strdup("no-preference"); break;
case DC_PE_RESET: pe = dc_strdup("reset"); break;
default: pe = dc_mprintf("unknown-value (%i)", peerstate->m_prefer_encrypt); break;
}
line2 = dc_mprintf(", prefer-encrypt=%s", pe);
free(pe);
@ -370,7 +370,7 @@ static void log_contactlist(dc_context_t* mailbox, dc_array_t* contacts)
free(addr);
}
else {
line = safe_strdup("Read error.");
line = dc_strdup("Read error.");
}
dc_log_info(mailbox, 0, "Contact#%i: %s%s", (int)contact_id, line, line2? line2:"");
free(line);
@ -417,7 +417,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
/* split commandline into command and first argument
(the first argument may contain spaces, if this is undesired we split further arguments form if below. */
cmd = safe_strdup(cmdline);
cmd = dc_strdup(cmdline);
arg1 = strchr(cmd, ' ');
if( arg1 ) { *arg1 = 0; arg1++; }
@ -426,7 +426,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
{
if( arg1 && strcmp(arg1, "imex")==0 )
{
ret = safe_strdup(
ret = dc_strdup(
"====================Import/Export commands==\n"
"initiate-key-transfer\n"
"get-setupcodebegin <msg-id>\n"
@ -444,7 +444,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
}
else
{
ret = safe_strdup(
ret = dc_strdup(
"==========================Database commands==\n"
"info\n"
"open <file to open or create>\n"
@ -518,12 +518,12 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
}
}
else {
ret = safe_strdup("Please authorize yourself using: auth <password>");
ret = dc_strdup("Please authorize yourself using: auth <password>");
}
}
else if( strcmp(cmd, "auth")==0 )
{
ret = safe_strdup("Already authorized.");
ret = dc_strdup("Already authorized.");
}
@ -538,7 +538,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = dc_open(mailbox, arg1, NULL)? COMMAND_SUCCEEDED : COMMAND_FAILED;
}
else {
ret = safe_strdup("ERROR: Argument <file> missing.");
ret = dc_strdup("ERROR: Argument <file> missing.");
}
}
else if( strcmp(cmd, "close")==0 )
@ -568,7 +568,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
dc_msg_unref(msg);
}
else {
ret = safe_strdup("ERROR: Argument <msg-id> missing.");
ret = dc_strdup("ERROR: Argument <msg-id> missing.");
}
}
else if( strcmp(cmd, "continue-key-transfer")==0 )
@ -580,14 +580,14 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = dc_continue_key_transfer(mailbox, atoi(arg1), arg2)? COMMAND_SUCCEEDED : COMMAND_FAILED;
}
else {
ret = safe_strdup("ERROR: Arguments <msg-id> <setup-code> expected.");
ret = dc_strdup("ERROR: Arguments <msg-id> <setup-code> expected.");
}
}
else if( strcmp(cmd, "has-backup")==0 )
{
ret = dc_imex_has_backup(mailbox, mailbox->m_blobdir);
if( ret == NULL ) {
ret = safe_strdup("No backup found.");
ret = dc_strdup("No backup found.");
}
}
else if( strcmp(cmd, "export-backup")==0 )
@ -600,7 +600,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = dc_imex(mailbox, DC_IMEX_IMPORT_BACKUP, arg1, NULL)? COMMAND_SUCCEEDED : COMMAND_FAILED;
}
else {
ret = safe_strdup("ERROR: Argument <backup-file> missing.");
ret = dc_strdup("ERROR: Argument <backup-file> missing.");
}
}
else if( strcmp(cmd, "export-keys")==0 )
@ -636,14 +636,14 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
if( arg1 ) {
int bits = atoi(arg1);
if( bits > 15 ) {
ret = safe_strdup("ERROR: <bits> must be lower than 16.");
ret = dc_strdup("ERROR: <bits> must be lower than 16.");
}
else {
ret = dc_reset_tables(mailbox, bits)? COMMAND_SUCCEEDED : COMMAND_FAILED;
}
}
else {
ret = safe_strdup("ERROR: Argument <bits> missing: 1=jobs, 2=peerstates, 4=private keys, 8=rest but server config");
ret = dc_strdup("ERROR: Argument <bits> missing: 1=jobs, 2=peerstates, 4=private keys, 8=rest but server config");
}
}
else if( strcmp(cmd, "set")==0 )
@ -657,7 +657,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = dc_set_config(mailbox, arg1, arg2)? COMMAND_SUCCEEDED : COMMAND_FAILED;
}
else {
ret = safe_strdup("ERROR: Argument <key> missing.");
ret = dc_strdup("ERROR: Argument <key> missing.");
}
}
else if( strcmp(cmd, "get")==0 )
@ -673,7 +673,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
}
}
else {
ret = safe_strdup("ERROR: Argument <key> missing.");
ret = dc_strdup("ERROR: Argument <key> missing.");
}
}
else if( strcmp(cmd, "info")==0 )
@ -783,7 +783,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
dc_marknoticed_chat(mailbox, dc_chat_get_id(sel_chat));
}
else {
ret = safe_strdup("No chat selected.");
ret = dc_strdup("No chat selected.");
}
}
else if( strcmp(cmd, "createchat")==0 )
@ -794,7 +794,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = chat_id!=0? dc_mprintf("Single#%lu created successfully.", chat_id) : COMMAND_FAILED;
}
else {
ret = safe_strdup("ERROR: Argument <contact-id> missing.");
ret = dc_strdup("ERROR: Argument <contact-id> missing.");
}
}
else if( strcmp(cmd, "createchatbymsg")==0 )
@ -812,7 +812,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
}
}
else {
ret = safe_strdup("ERROR: Argument <msg-id> missing.");
ret = dc_strdup("ERROR: Argument <msg-id> missing.");
}
}
else if( strcmp(cmd, "creategroup")==0 )
@ -822,7 +822,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = chat_id!=0? dc_mprintf("Group#%lu created successfully.", chat_id) : COMMAND_FAILED;
}
else {
ret = safe_strdup("ERROR: Argument <name> missing.");
ret = dc_strdup("ERROR: Argument <name> missing.");
}
}
else if( strcmp(cmd, "createverified")==0 )
@ -832,7 +832,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = chat_id!=0? dc_mprintf("VerifiedGroup#%lu created successfully.", chat_id) : COMMAND_FAILED;
}
else {
ret = safe_strdup("ERROR: Argument <name> missing.");
ret = dc_strdup("ERROR: Argument <name> missing.");
}
}
else if( strcmp(cmd, "addmember")==0 )
@ -841,18 +841,18 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
if( arg1 ) {
int contact_id = atoi(arg1);
if( dc_add_contact_to_chat(mailbox, dc_chat_get_id(sel_chat), contact_id) ) {
ret = safe_strdup("Contact added to chat.");
ret = dc_strdup("Contact added to chat.");
}
else {
ret = safe_strdup("ERROR: Cannot add contact to chat.");
ret = dc_strdup("ERROR: Cannot add contact to chat.");
}
}
else {
ret = safe_strdup("ERROR: Argument <contact-id> missing.");
ret = dc_strdup("ERROR: Argument <contact-id> missing.");
}
}
else {
ret = safe_strdup("No chat selected.");
ret = dc_strdup("No chat selected.");
}
}
else if( strcmp(cmd, "removemember")==0 )
@ -861,18 +861,18 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
if( arg1 ) {
int contact_id = atoi(arg1);
if( dc_remove_contact_from_chat(mailbox, dc_chat_get_id(sel_chat), contact_id) ) {
ret = safe_strdup("Contact added to chat.");
ret = dc_strdup("Contact added to chat.");
}
else {
ret = safe_strdup("ERROR: Cannot remove member from chat.");
ret = dc_strdup("ERROR: Cannot remove member from chat.");
}
}
else {
ret = safe_strdup("ERROR: Argument <contact-id> missing.");
ret = dc_strdup("ERROR: Argument <contact-id> missing.");
}
}
else {
ret = safe_strdup("No chat selected.");
ret = dc_strdup("No chat selected.");
}
}
else if( strcmp(cmd, "groupname")==0 )
@ -882,11 +882,11 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = dc_set_chat_name(mailbox, dc_chat_get_id(sel_chat), arg1)? COMMAND_SUCCEEDED : COMMAND_FAILED;
}
else {
ret = safe_strdup("ERROR: Argument <name> missing.");
ret = dc_strdup("ERROR: Argument <name> missing.");
}
}
else {
ret = safe_strdup("No chat selected.");
ret = dc_strdup("No chat selected.");
}
}
else if( strcmp(cmd, "groupimage")==0 )
@ -895,7 +895,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = dc_set_chat_profile_image(mailbox, dc_chat_get_id(sel_chat), (arg1&&arg1[0])?arg1:NULL)? COMMAND_SUCCEEDED : COMMAND_FAILED;
}
else {
ret = safe_strdup("No chat selected.");
ret = dc_strdup("No chat selected.");
}
}
else if( strcmp(cmd, "chatinfo")==0 )
@ -912,7 +912,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
}
}
else {
ret = safe_strdup("No chat selected.");
ret = dc_strdup("No chat selected.");
}
}
else if( strcmp(cmd, "send")==0 )
@ -920,18 +920,18 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
if( sel_chat ) {
if( arg1 && arg1[0] ) {
if( dc_send_text_msg(mailbox, dc_chat_get_id(sel_chat), arg1) ) {
ret = safe_strdup("Message sent.");
ret = dc_strdup("Message sent.");
}
else {
ret = safe_strdup("ERROR: Sending failed.");
ret = dc_strdup("ERROR: Sending failed.");
}
}
else {
ret = safe_strdup("ERROR: No message text given.");
ret = dc_strdup("ERROR: No message text given.");
}
}
else {
ret = safe_strdup("No chat selected.");
ret = dc_strdup("No chat selected.");
}
}
else if( strcmp(cmd, "sendimage")==0 )
@ -939,18 +939,18 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
if( sel_chat ) {
if( arg1 && arg1[0] ) {
if( dc_send_image_msg(mailbox, dc_chat_get_id(sel_chat), arg1, NULL, 0, 0) ) {
ret = safe_strdup("Image sent.");
ret = dc_strdup("Image sent.");
}
else {
ret = safe_strdup("ERROR: Sending image failed.");
ret = dc_strdup("ERROR: Sending image failed.");
}
}
else {
ret = safe_strdup("ERROR: No image given.");
ret = dc_strdup("ERROR: No image given.");
}
}
else {
ret = safe_strdup("No chat selected.");
ret = dc_strdup("No chat selected.");
}
}
else if( strcmp(cmd, "sendfile")==0 )
@ -958,18 +958,18 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
if( sel_chat ) {
if( arg1 && arg1[0] ) {
if( dc_send_file_msg(mailbox, dc_chat_get_id(sel_chat), arg1, NULL) ) {
ret = safe_strdup("File sent.");
ret = dc_strdup("File sent.");
}
else {
ret = safe_strdup("ERROR: Sending file failed.");
ret = dc_strdup("ERROR: Sending file failed.");
}
}
else {
ret = safe_strdup("ERROR: No file given.");
ret = dc_strdup("ERROR: No file given.");
}
}
else {
ret = safe_strdup("No chat selected.");
ret = dc_strdup("No chat selected.");
}
}
else if( strcmp(cmd, "listmsgs")==0 )
@ -983,7 +983,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
}
}
else {
ret = safe_strdup("ERROR: Argument <query> missing.");
ret = dc_strdup("ERROR: Argument <query> missing.");
}
}
else if( strcmp(cmd, "draft")==0 )
@ -991,15 +991,15 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
if( sel_chat ) {
if( arg1 && arg1[0] ) {
dc_set_draft(mailbox, dc_chat_get_id(sel_chat), arg1);
ret = safe_strdup("Draft saved.");
ret = dc_strdup("Draft saved.");
}
else {
dc_set_draft(mailbox, dc_chat_get_id(sel_chat), NULL);
ret = safe_strdup("Draft deleted.");
ret = dc_strdup("Draft deleted.");
}
}
else {
ret = safe_strdup("No chat selected.");
ret = dc_strdup("No chat selected.");
}
}
else if( strcmp(cmd, "listmedia")==0 )
@ -1016,7 +1016,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
dc_array_unref(images);
}
else {
ret = safe_strdup("No chat selected.");
ret = dc_strdup("No chat selected.");
}
}
else if( strcmp(cmd, "archive")==0 || strcmp(cmd, "unarchive")==0 )
@ -1027,7 +1027,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = COMMAND_SUCCEEDED;
}
else {
ret = safe_strdup("ERROR: Argument <chat-id> missing.");
ret = dc_strdup("ERROR: Argument <chat-id> missing.");
}
}
else if( strcmp(cmd, "delchat")==0 )
@ -1038,7 +1038,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = COMMAND_SUCCEEDED;
}
else {
ret = safe_strdup("ERROR: Argument <chat-id> missing.");
ret = dc_strdup("ERROR: Argument <chat-id> missing.");
}
}
@ -1054,7 +1054,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = dc_get_msg_info(mailbox, id);
}
else {
ret = safe_strdup("ERROR: Argument <msg-id> missing.");
ret = dc_strdup("ERROR: Argument <msg-id> missing.");
}
}
else if( strcmp(cmd, "listfresh")==0 )
@ -1078,7 +1078,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = COMMAND_SUCCEEDED;
}
else {
ret = safe_strdup("ERROR: Arguments <msg-id> <chat-id> expected.");
ret = dc_strdup("ERROR: Arguments <msg-id> <chat-id> expected.");
}
}
else if( strcmp(cmd, "markseen")==0 )
@ -1090,7 +1090,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = COMMAND_SUCCEEDED;
}
else {
ret = safe_strdup("ERROR: Argument <msg-id> missing.");
ret = dc_strdup("ERROR: Argument <msg-id> missing.");
}
}
else if( strcmp(cmd, "star")==0 || strcmp(cmd, "unstar")==0 )
@ -1102,7 +1102,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = COMMAND_SUCCEEDED;
}
else {
ret = safe_strdup("ERROR: Argument <msg-id> missing.");
ret = dc_strdup("ERROR: Argument <msg-id> missing.");
}
}
else if( strcmp(cmd, "delmsg")==0 )
@ -1114,7 +1114,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = COMMAND_SUCCEEDED;
}
else {
ret = safe_strdup("ERROR: Argument <msg-id> missing.");
ret = dc_strdup("ERROR: Argument <msg-id> missing.");
}
}
@ -1150,7 +1150,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = dc_create_contact(mailbox, NULL, arg1)? COMMAND_SUCCEEDED : COMMAND_FAILED;
}
else {
ret = safe_strdup("ERROR: Arguments [<name>] <addr> expected.");
ret = dc_strdup("ERROR: Arguments [<name>] <addr> expected.");
}
}
else if( strcmp(cmd, "contactinfo")==0 )
@ -1187,7 +1187,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = strbuilder.m_buf;
}
else {
ret = safe_strdup("ERROR: Argument <contact-id> missing.");
ret = dc_strdup("ERROR: Argument <contact-id> missing.");
}
}
else if( strcmp(cmd, "delcontact")==0 )
@ -1196,7 +1196,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = dc_delete_contact(mailbox, atoi(arg1))? COMMAND_SUCCEEDED : COMMAND_FAILED;
}
else {
ret = safe_strdup("ERROR: Argument <contact-id> missing.");
ret = dc_strdup("ERROR: Argument <contact-id> missing.");
}
}
else if( strcmp(cmd, "cleanupcontacts")==0 )
@ -1221,7 +1221,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
dc_lot_unref(res);
}
else {
ret = safe_strdup("ERROR: Argument <qr-content> missing.");
ret = dc_strdup("ERROR: Argument <qr-content> missing.");
}
}
else if( strcmp(cmd, "event")==0 )
@ -1232,7 +1232,7 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = dc_mprintf("Sending event %i, received value %i.", (int)event, (int)r);
}
else {
ret = safe_strdup("ERROR: Argument <id> missing.");
ret = dc_strdup("ERROR: Argument <id> missing.");
}
}
else if( strcmp(cmd, "fileinfo")==0 )
@ -1244,12 +1244,12 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
ret = dc_mprintf("width=%i, height=%i", (int)w, (int)h);
}
else {
ret = safe_strdup("ERROR: Command failed.");
ret = dc_strdup("ERROR: Command failed.");
}
free(buf);
}
else {
ret = safe_strdup("ERROR: Argument <file> missing.");
ret = dc_strdup("ERROR: Argument <file> missing.");
}
}
else
@ -1259,10 +1259,10 @@ char* dc_cmdline(dc_context_t* mailbox, const char* cmdline)
cleanup:
if( ret == COMMAND_SUCCEEDED ) {
ret = safe_strdup("Command executed successfully.");
ret = dc_strdup("Command executed successfully.");
}
else if( ret == COMMAND_FAILED ) {
ret = safe_strdup("ERROR: Command failed.");
ret = dc_strdup("ERROR: Command failed.");
}
else if( ret == COMMAND_UNKNOWN ) {
ret = dc_mprintf("ERROR: Unknown command \"%s\", type ? for help.", cmd);

View file

@ -240,7 +240,7 @@ int main(int argc, char ** argv)
/* read command */
const char* cmdline = read_cmd();
free(cmd);
cmd = safe_strdup(cmdline);
cmd = dc_strdup(cmdline);
char* arg1 = strchr(cmd, ' ');
if( arg1 ) { *arg1 = 0; arg1++; }

View file

@ -720,7 +720,7 @@ void stress_functions(dc_context_t* context)
assert( (setupfile=dc_render_setup_file(context, setupcode)) != NULL );
{
char *buf = safe_strdup(setupfile);
char *buf = dc_strdup(setupfile);
const char *headerline = NULL, *setupcodebegin = NULL;
assert( dc_split_armored_data(buf, &headerline, &setupcodebegin, NULL, NULL) );
assert( headerline && strcmp(headerline, "-----BEGIN PGP MESSAGE-----")==0 );

View file

@ -27,7 +27,7 @@ extern "C" {
#endif
void stress_functions(mrmailbox_t*);
void stress_functions(dc_context_t*);
#ifdef __cplusplus

View file

@ -118,7 +118,7 @@ static int add_attribute(dc_aheader_t* ths, const char* name, const char* value
ths->m_addr = dc_normalize_addr(value);
return 1;
}
#if 0 /* autoctypt 11/2017 no longer uses the type attribute and it will make the autocrypt header invalid */
#if 0 /* autocrypt 11/2017 no longer uses the type attribute and it will make the autocrypt header invalid */
else if( strcasecmp(name, "type")==0 )
{
if( value == NULL ) {

View file

@ -20,8 +20,8 @@
******************************************************************************/
#ifndef __MRAHEADER_H__
#define __MRAHEADER_H__
#ifndef __DC_AHEADER_H__
#define __DC_AHEADER_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -36,7 +36,7 @@ extern "C" {
typedef struct dc_aheader_t
{
char* m_addr;
dc_key_t* m_public_key; /* != NULL */
dc_key_t* m_public_key; /* != NULL */
int m_prefer_encrypt; /* YES, NO or NOPREFERENCE if attribute is missing */
} dc_aheader_t;
@ -54,4 +54,4 @@ char* dc_aheader_render (const dc_aheader_t*);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRAHEADER_H__ */
#endif /* __DC_AHEADER_H__ */

View file

@ -536,7 +536,7 @@ cleanup:
* @memberof dc_apeerstate_t
*
* @param peerstate The peerstate object.
* @param which_key Which key should be marked as being verified? MRA_GOSSIP_KEY (1) or MRA_PUBLIC_KEY (2)
* @param which_key Which key should be marked as being verified? DC_PS_GOSSIP_KEY (1) or DC_PS_PUBLIC_KEY (2)
* @param fingerprint Fingerprint expected in the object
* @param verified DC_BIDIRECT_VERIFIED (2): contact verfied in both directions
*
@ -551,12 +551,12 @@ int dc_apeerstate_set_verified(dc_apeerstate_t* peerstate, int which_key, const
int success = 0;
if( peerstate == NULL
|| (which_key!=MRA_GOSSIP_KEY && which_key!=MRA_PUBLIC_KEY)
|| (which_key!=DC_PS_GOSSIP_KEY && which_key!=DC_PS_PUBLIC_KEY)
|| (verified!=DC_BIDIRECT_VERIFIED) ) {
goto cleanup;
}
if( which_key == MRA_PUBLIC_KEY
if( which_key == DC_PS_PUBLIC_KEY
&& peerstate->m_public_key_fingerprint != NULL
&& peerstate->m_public_key_fingerprint[0] != 0
&& fingerprint[0] != 0
@ -568,7 +568,7 @@ int dc_apeerstate_set_verified(dc_apeerstate_t* peerstate, int which_key, const
success = 1;
}
if( which_key == MRA_GOSSIP_KEY
if( which_key == DC_PS_GOSSIP_KEY
&& peerstate->m_gossip_key_fingerprint != NULL
&& peerstate->m_gossip_key_fingerprint[0] != 0
&& fingerprint[0] != 0

View file

@ -20,8 +20,8 @@
******************************************************************************/
#ifndef __MRAPEERSTATE_H__
#define __MRAPEERSTATE_H__
#ifndef __DC_APEERSTATE_H__
#define __DC_APEERSTATE_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -77,34 +77,34 @@ typedef struct dc_apeerstate_t
dc_apeerstate_t* dc_apeerstate_new (dc_context_t*); /* the returned pointer is ref'd and must be unref'd after usage */
void dc_apeerstate_unref (dc_apeerstate_t*);
void dc_apeerstate_unref (dc_apeerstate_t*);
int dc_apeerstate_init_from_header (dc_apeerstate_t*, const dc_aheader_t*, time_t message_time);
int dc_apeerstate_init_from_gossip (dc_apeerstate_t*, const dc_aheader_t*, time_t message_time);
int dc_apeerstate_init_from_header (dc_apeerstate_t*, const dc_aheader_t*, time_t message_time);
int dc_apeerstate_init_from_gossip (dc_apeerstate_t*, const dc_aheader_t*, time_t message_time);
int dc_apeerstate_degrade_encryption (dc_apeerstate_t*, time_t message_time);
int dc_apeerstate_degrade_encryption (dc_apeerstate_t*, time_t message_time);
void dc_apeerstate_apply_header (dc_apeerstate_t*, const dc_aheader_t*, time_t message_time);
void dc_apeerstate_apply_gossip (dc_apeerstate_t*, const dc_aheader_t*, time_t message_time);
void dc_apeerstate_apply_header (dc_apeerstate_t*, const dc_aheader_t*, time_t message_time);
void dc_apeerstate_apply_gossip (dc_apeerstate_t*, const dc_aheader_t*, time_t message_time);
char* dc_apeerstate_render_gossip_header (const dc_apeerstate_t*, int min_verified);
char* dc_apeerstate_render_gossip_header (const dc_apeerstate_t*, int min_verified);
dc_key_t* dc_apeerstate_peek_key (const dc_apeerstate_t*, int min_verified);
int dc_apeerstate_recalc_fingerprint (dc_apeerstate_t*);
int dc_apeerstate_recalc_fingerprint (dc_apeerstate_t*);
#define MRA_GOSSIP_KEY 0
#define MRA_PUBLIC_KEY 1
int dc_apeerstate_set_verified (dc_apeerstate_t*, int which_key, const char* fingerprint, int verfied);
#define DC_PS_GOSSIP_KEY 0
#define DC_PS_PUBLIC_KEY 1
int dc_apeerstate_set_verified (dc_apeerstate_t*, int which_key, const char* fingerprint, int verfied);
int dc_apeerstate_load_by_addr__ (dc_apeerstate_t*, dc_sqlite3_t*, const char* addr);
int dc_apeerstate_load_by_fingerprint__(dc_apeerstate_t*, dc_sqlite3_t*, const char* fingerprint);
int dc_apeerstate_save_to_db__ (const dc_apeerstate_t*, dc_sqlite3_t*, int create);
int dc_apeerstate_load_by_addr__ (dc_apeerstate_t*, dc_sqlite3_t*, const char* addr);
int dc_apeerstate_load_by_fingerprint__(dc_apeerstate_t*, dc_sqlite3_t*, const char* fingerprint);
int dc_apeerstate_save_to_db__ (const dc_apeerstate_t*, dc_sqlite3_t*, int create);
int dc_apeerstate_has_verified_key (const dc_apeerstate_t*, const dc_hash_t* fingerprints);
int dc_apeerstate_has_verified_key (const dc_apeerstate_t*, const dc_hash_t* fingerprints);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRAPEERSTATE_H__ */
#endif /* __DC_APEERSTATE_H__ */

View file

@ -23,7 +23,7 @@
#include "dc_context.h"
#include "dc_array.h"
#define MR_ARRAY_MAGIC 0x000a11aa
#define DC_ARRAY_MAGIC 0x000a11aa
/**
@ -45,7 +45,7 @@ dc_array_t* dc_array_new(dc_context_t* mailbox, size_t initsize)
exit(47);
}
array->m_magic = MR_ARRAY_MAGIC;
array->m_magic = DC_ARRAY_MAGIC;
array->m_context = mailbox;
array->m_count = 0;
array->m_allocated = initsize < 1? 1 : initsize;
@ -70,7 +70,7 @@ dc_array_t* dc_array_new(dc_context_t* mailbox, size_t initsize)
*/
void dc_array_unref(dc_array_t* array)
{
if( array==NULL || array->m_magic != MR_ARRAY_MAGIC ) {
if( array==NULL || array->m_magic != DC_ARRAY_MAGIC ) {
return;
}
@ -95,7 +95,7 @@ void dc_array_free_ptr(dc_array_t* array)
{
size_t i;
if( array==NULL || array->m_magic != MR_ARRAY_MAGIC ) {
if( array==NULL || array->m_magic != DC_ARRAY_MAGIC ) {
return;
}
@ -121,7 +121,7 @@ dc_array_t* dc_array_duplicate(const dc_array_t* array)
{
dc_array_t* ret = NULL;
if( array==NULL || array->m_magic != MR_ARRAY_MAGIC ) {
if( array==NULL || array->m_magic != DC_ARRAY_MAGIC ) {
return NULL;
}
@ -152,7 +152,7 @@ static int cmp_intptr_t(const void* p1, const void* p2)
*/
void dc_array_sort_ids(dc_array_t* array)
{
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || array->m_count <= 1 ) {
if( array == NULL || array->m_magic != DC_ARRAY_MAGIC || array->m_count <= 1 ) {
return;
}
qsort(array->m_array, array->m_count, sizeof(uintptr_t), cmp_intptr_t);
@ -179,7 +179,7 @@ static int cmp_strings_t(const void* p1, const void* p2)
*/
void dc_array_sort_strings(dc_array_t* array)
{
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || array->m_count <= 1 ) {
if( array == NULL || array->m_magic != DC_ARRAY_MAGIC || array->m_count <= 1 ) {
return;
}
qsort(array->m_array, array->m_count, sizeof(char*), cmp_strings_t);
@ -197,7 +197,7 @@ void dc_array_sort_strings(dc_array_t* array)
*/
void dc_array_empty(dc_array_t* array)
{
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
if( array == NULL || array->m_magic != DC_ARRAY_MAGIC ) {
return;
}
@ -218,7 +218,7 @@ void dc_array_empty(dc_array_t* array)
*/
void dc_array_add_uint(dc_array_t* array, uintptr_t item)
{
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
if( array == NULL || array->m_magic != DC_ARRAY_MAGIC ) {
return;
}
@ -280,7 +280,7 @@ void dc_array_add_ptr(dc_array_t* array, void* item)
*/
size_t dc_array_get_cnt(const dc_array_t* array)
{
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
if( array == NULL || array->m_magic != DC_ARRAY_MAGIC ) {
return 0;
}
@ -301,7 +301,7 @@ size_t dc_array_get_cnt(const dc_array_t* array)
*/
uintptr_t dc_array_get_uint(const dc_array_t* array, size_t index)
{
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || index < 0 || index >= array->m_count ) {
if( array == NULL || array->m_magic != DC_ARRAY_MAGIC || index < 0 || index >= array->m_count ) {
return 0;
}
@ -321,7 +321,7 @@ uintptr_t dc_array_get_uint(const dc_array_t* array, size_t index)
*/
uint32_t dc_array_get_id(const dc_array_t* array, size_t index)
{
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || index < 0 || index >= array->m_count ) {
if( array == NULL || array->m_magic != DC_ARRAY_MAGIC || index < 0 || index >= array->m_count ) {
return 0;
}
@ -341,7 +341,7 @@ uint32_t dc_array_get_id(const dc_array_t* array, size_t index)
*/
void* dc_array_get_ptr(const dc_array_t* array, size_t index)
{
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || index < 0 || index >= array->m_count ) {
if( array == NULL || array->m_magic != DC_ARRAY_MAGIC || index < 0 || index >= array->m_count ) {
return 0;
}
@ -362,7 +362,7 @@ void* dc_array_get_ptr(const dc_array_t* array, size_t index)
*/
int dc_array_search_id(const dc_array_t* array, uint32_t needle, size_t* ret_index)
{
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
if( array == NULL || array->m_magic != DC_ARRAY_MAGIC ) {
return 0;
}
@ -394,7 +394,7 @@ int dc_array_search_id(const dc_array_t* array, uint32_t needle, size_t* ret_ind
*/
const uintptr_t* dc_array_get_raw(const dc_array_t* array)
{
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
if( array == NULL || array->m_magic != DC_ARRAY_MAGIC ) {
return NULL;
}
return array->m_array;
@ -435,7 +435,7 @@ char* dc_array_get_string(const dc_array_t* array, const char* sep)
{
char* ret = NULL;
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || sep==NULL ) {
if( array == NULL || array->m_magic != DC_ARRAY_MAGIC || sep==NULL ) {
return dc_strdup("");
}

View file

@ -20,8 +20,8 @@
******************************************************************************/
#ifndef __MRARRAY_PRIVATE_H__
#define __MRARRAY_PRIVATE_H__
#ifndef __DC_ARRAY_H__
#define __DC_ARRAY_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -51,4 +51,4 @@ char* dc_arr_to_string (const uint32_t* arr, int cnt);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRARRAY_PRIVATE_H__ */
#endif /* __DC_ARRAY_H__ */

View file

@ -27,7 +27,7 @@
#include "dc_mimefactory.h"
#define MR_CHAT_MAGIC 0xc4a7c4a7
#define DC_CHAT_MAGIC 0xc4a7c4a7
/**
@ -47,7 +47,7 @@ dc_chat_t* dc_chat_new(dc_context_t* mailbox)
exit(14); /* cannot allocate little memory, unrecoverable error */
}
ths->m_magic = MR_CHAT_MAGIC;
ths->m_magic = DC_CHAT_MAGIC;
ths->m_context = mailbox;
ths->m_type = DC_CHAT_TYPE_UNDEFINED;
ths->m_param = dc_param_new();
@ -67,7 +67,7 @@ dc_chat_t* dc_chat_new(dc_context_t* mailbox)
*/
void dc_chat_unref(dc_chat_t* chat)
{
if( chat==NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat==NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return;
}
@ -89,7 +89,7 @@ void dc_chat_unref(dc_chat_t* chat)
*/
void dc_chat_empty(dc_chat_t* chat)
{
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat == NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return;
}
@ -136,7 +136,7 @@ void dc_chat_empty(dc_chat_t* chat)
*/
uint32_t dc_chat_get_id(dc_chat_t* chat)
{
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat == NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return 0;
}
@ -167,7 +167,7 @@ uint32_t dc_chat_get_id(dc_chat_t* chat)
*/
int dc_chat_get_type(dc_chat_t* chat)
{
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat == NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return DC_CHAT_TYPE_UNDEFINED;
}
return chat->m_type;
@ -191,7 +191,7 @@ int dc_chat_get_type(dc_chat_t* chat)
*/
char* dc_chat_get_name(dc_chat_t* chat)
{
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat == NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return dc_strdup("Err");
}
@ -217,7 +217,7 @@ char* dc_chat_get_subtitle(dc_chat_t* chat)
char* ret = NULL;
sqlite3_stmt* stmt;
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat == NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return dc_strdup("Err");
}
@ -279,7 +279,7 @@ char* dc_chat_get_subtitle(dc_chat_t* chat)
*/
char* dc_chat_get_profile_image(dc_chat_t* chat)
{
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat == NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return NULL;
}
@ -302,7 +302,7 @@ char* dc_chat_get_profile_image(dc_chat_t* chat)
*/
char* dc_chat_get_draft(dc_chat_t* chat)
{
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat == NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return NULL;
}
return dc_strdup_keep_null(chat->m_draft_text); /* may be NULL */
@ -323,7 +323,7 @@ char* dc_chat_get_draft(dc_chat_t* chat)
*/
time_t dc_chat_get_draft_timestamp(dc_chat_t* chat)
{
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat == NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return 0;
}
return chat->m_draft_timestamp;
@ -349,7 +349,7 @@ time_t dc_chat_get_draft_timestamp(dc_chat_t* chat)
*/
int dc_chat_get_archived(dc_chat_t* chat)
{
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat == NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return 0;
}
return chat->m_archived;
@ -373,7 +373,7 @@ int dc_chat_get_archived(dc_chat_t* chat)
*/
int dc_chat_is_unpromoted(dc_chat_t* chat)
{
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat == NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return 0;
}
return dc_param_get_int(chat->m_param, DC_PARAM_UNPROMOTED, 0);
@ -393,7 +393,7 @@ int dc_chat_is_unpromoted(dc_chat_t* chat)
*/
int dc_chat_is_verified(dc_chat_t* chat)
{
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat == NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return 0;
}
return (chat->m_type==DC_CHAT_TYPE_VERIFIED_GROUP);
@ -405,7 +405,7 @@ int dc_chat_are_all_members_verified__(dc_chat_t* chat)
int chat_verified = 0;
sqlite3_stmt* stmt;
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat == NULL || chat->m_magic != DC_CHAT_MAGIC ) {
goto cleanup;
}
@ -450,7 +450,7 @@ cleanup:
*/
int dc_chat_is_self_talk(dc_chat_t* chat)
{
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat == NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return 0;
}
return dc_param_exists(chat->m_param, DC_PARAM_SELFTALK);
@ -476,23 +476,23 @@ int dc_chat_update_param__(dc_chat_t* ths)
static int dc_chat_set_from_stmt__(dc_chat_t* ths, sqlite3_stmt* row)
{
int row_offset = 0;
int row_offset = 0;
const char* draft_text;
if( ths == NULL || ths->m_magic != MR_CHAT_MAGIC || row == NULL ) {
if( ths == NULL || ths->m_magic != DC_CHAT_MAGIC || row == NULL ) {
return 0;
}
dc_chat_empty(ths);
#define MR_CHAT_FIELDS " c.id,c.type,c.name, c.draft_timestamp,c.draft_txt,c.grpid,c.param,c.archived, c.blocked "
ths->m_id = sqlite3_column_int (row, row_offset++); /* the columns are defined in MR_CHAT_FIELDS */
#define CHAT_FIELDS " c.id,c.type,c.name, c.draft_timestamp,c.draft_txt,c.grpid,c.param,c.archived, c.blocked "
ths->m_id = sqlite3_column_int (row, row_offset++); /* the columns are defined in CHAT_FIELDS */
ths->m_type = sqlite3_column_int (row, row_offset++);
ths->m_name = dc_strdup((char*)sqlite3_column_text (row, row_offset++));
ths->m_name = dc_strdup((char*)sqlite3_column_text (row, row_offset++));
ths->m_draft_timestamp = sqlite3_column_int64(row, row_offset++);
draft_text = (const char*)sqlite3_column_text (row, row_offset++);
ths->m_grpid = dc_strdup((char*)sqlite3_column_text (row, row_offset++));
dc_param_set_packed(ths->m_param, (char*)sqlite3_column_text (row, row_offset++));
ths->m_grpid = dc_strdup((char*)sqlite3_column_text (row, row_offset++));
dc_param_set_packed(ths->m_param, (char*)sqlite3_column_text (row, row_offset++));
ths->m_archived = sqlite3_column_int (row, row_offset++);
ths->m_blocked = sqlite3_column_int (row, row_offset++);
@ -547,14 +547,14 @@ int dc_chat_load_from_db__(dc_chat_t* chat, uint32_t chat_id)
{
sqlite3_stmt* stmt;
if( chat==NULL || chat->m_magic != MR_CHAT_MAGIC ) {
if( chat==NULL || chat->m_magic != DC_CHAT_MAGIC ) {
return 0;
}
dc_chat_empty(chat);
stmt = dc_sqlite3_predefine__(chat->m_context->m_sql, SELECT_itndd_FROM_chats_WHERE_i,
"SELECT " MR_CHAT_FIELDS " FROM chats c WHERE c.id=?;");
"SELECT " CHAT_FIELDS " FROM chats c WHERE c.id=?;");
sqlite3_bind_int(stmt, 1, chat_id);
if( sqlite3_step(stmt) != SQLITE_ROW ) {

View file

@ -23,7 +23,7 @@
#include "dc_context.h"
#define MR_CHATLIST_MAGIC 0xc4a71157
#define DC_CHATLIST_MAGIC 0xc4a71157
/**
@ -43,7 +43,7 @@ dc_chatlist_t* dc_chatlist_new(dc_context_t* mailbox)
exit(20);
}
ths->m_magic = MR_CHATLIST_MAGIC;
ths->m_magic = DC_CHATLIST_MAGIC;
ths->m_context = mailbox;
if( (ths->m_chatNlastmsg_ids=dc_array_new(mailbox, 128))==NULL ) {
exit(32);
@ -65,7 +65,7 @@ dc_chatlist_t* dc_chatlist_new(dc_context_t* mailbox)
*/
void dc_chatlist_unref(dc_chatlist_t* chatlist)
{
if( chatlist==NULL || chatlist->m_magic != MR_CHATLIST_MAGIC ) {
if( chatlist==NULL || chatlist->m_magic != DC_CHATLIST_MAGIC ) {
return;
}
@ -87,7 +87,7 @@ void dc_chatlist_unref(dc_chatlist_t* chatlist)
*/
void dc_chatlist_empty(dc_chatlist_t* chatlist)
{
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC ) {
if( chatlist == NULL || chatlist->m_magic != DC_CHATLIST_MAGIC ) {
return;
}
@ -107,7 +107,7 @@ void dc_chatlist_empty(dc_chatlist_t* chatlist)
*/
size_t dc_chatlist_get_cnt(dc_chatlist_t* chatlist)
{
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC ) {
if( chatlist == NULL || chatlist->m_magic != DC_CHATLIST_MAGIC ) {
return 0;
}
@ -131,11 +131,11 @@ size_t dc_chatlist_get_cnt(dc_chatlist_t* chatlist)
*/
uint32_t dc_chatlist_get_chat_id(dc_chatlist_t* chatlist, size_t index)
{
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC || chatlist->m_chatNlastmsg_ids == NULL || index >= chatlist->m_cnt ) {
if( chatlist == NULL || chatlist->m_magic != DC_CHATLIST_MAGIC || chatlist->m_chatNlastmsg_ids == NULL || index >= chatlist->m_cnt ) {
return 0;
}
return dc_array_get_id(chatlist->m_chatNlastmsg_ids, index*MR_CHATLIST_IDS_PER_RESULT);
return dc_array_get_id(chatlist->m_chatNlastmsg_ids, index*DC_CHATLIST_IDS_PER_RESULT);
}
@ -155,11 +155,11 @@ uint32_t dc_chatlist_get_chat_id(dc_chatlist_t* chatlist, size_t index)
*/
uint32_t dc_chatlist_get_msg_id(dc_chatlist_t* chatlist, size_t index)
{
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC || chatlist->m_chatNlastmsg_ids == NULL || index >= chatlist->m_cnt ) {
if( chatlist == NULL || chatlist->m_magic != DC_CHATLIST_MAGIC || chatlist->m_chatNlastmsg_ids == NULL || index >= chatlist->m_cnt ) {
return 0;
}
return dc_array_get_id(chatlist->m_chatNlastmsg_ids, index*MR_CHATLIST_IDS_PER_RESULT+1);
return dc_array_get_id(chatlist->m_chatNlastmsg_ids, index*DC_CHATLIST_IDS_PER_RESULT+1);
}
@ -206,12 +206,12 @@ dc_lot_t* dc_chatlist_get_summary(dc_chatlist_t* chatlist, size_t index, dc_chat
dc_contact_t* lastcontact = NULL;
dc_chat_t* chat_to_delete = NULL;
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC || index >= chatlist->m_cnt ) {
if( chatlist == NULL || chatlist->m_magic != DC_CHATLIST_MAGIC || index >= chatlist->m_cnt ) {
ret->m_text2 = dc_strdup("ErrBadChatlistIndex");
goto cleanup;
}
lastmsg_id = dc_array_get_id(chatlist->m_chatNlastmsg_ids, index*MR_CHATLIST_IDS_PER_RESULT+1);
lastmsg_id = dc_array_get_id(chatlist->m_chatNlastmsg_ids, index*DC_CHATLIST_IDS_PER_RESULT+1);
/* load data from database */
dc_sqlite3_lock(chatlist->m_context->m_sql);
@ -220,7 +220,7 @@ dc_lot_t* dc_chatlist_get_summary(dc_chatlist_t* chatlist, size_t index, dc_chat
if( chat==NULL ) {
chat = dc_chat_new(chatlist->m_context);
chat_to_delete = chat;
if( !dc_chat_load_from_db__(chat, dc_array_get_id(chatlist->m_chatNlastmsg_ids, index*MR_CHATLIST_IDS_PER_RESULT)) ) {
if( !dc_chat_load_from_db__(chat, dc_array_get_id(chatlist->m_chatNlastmsg_ids, index*DC_CHATLIST_IDS_PER_RESULT)) ) {
ret->m_text2 = dc_strdup("ErrCannotReadChat");
goto cleanup;
}
@ -253,10 +253,10 @@ dc_lot_t* dc_chatlist_get_summary(dc_chatlist_t* chatlist, size_t index, dc_chat
{
/* show the draft as the last message */
ret->m_text1 = dc_stock_str(DC_STR_DRAFT);
ret->m_text1_meaning = MR_TEXT1_DRAFT;
ret->m_text1_meaning = DC_TEXT1_DRAFT;
ret->m_text2 = dc_strdup(chat->m_draft_text);
dc_truncate_n_unwrap_str(ret->m_text2, MR_SUMMARY_CHARACTERS, 1/*unwrap*/);
dc_truncate_n_unwrap_str(ret->m_text2, DC_SUMMARY_CHARACTERS, 1/*unwrap*/);
ret->m_timestamp = chat->m_draft_timestamp;
}
@ -291,7 +291,7 @@ cleanup:
*/
dc_context_t* dc_chatlist_get_context(dc_chatlist_t* chatlist)
{
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC ) {
if( chatlist == NULL || chatlist->m_magic != DC_CHATLIST_MAGIC ) {
return NULL;
}
return chatlist->m_context;
@ -314,7 +314,7 @@ int dc_chatlist_load_from_db__(dc_chatlist_t* ths, int listflags, const char* qu
sqlite3_stmt* stmt = NULL;
char* strLikeCmd = NULL, *query = NULL;
if( ths == NULL || ths->m_magic != MR_CHATLIST_MAGIC || ths->m_context == NULL ) {
if( ths == NULL || ths->m_magic != DC_CHATLIST_MAGIC || ths->m_context == NULL ) {
goto cleanup;
}
@ -388,7 +388,7 @@ int dc_chatlist_load_from_db__(dc_chatlist_t* ths, int listflags, const char* qu
dc_array_add_id(ths->m_chatNlastmsg_ids, 0);
}
ths->m_cnt = dc_array_get_cnt(ths->m_chatNlastmsg_ids)/MR_CHATLIST_IDS_PER_RESULT;
ths->m_cnt = dc_array_get_cnt(ths->m_chatNlastmsg_ids)/DC_CHATLIST_IDS_PER_RESULT;
success = 1;
cleanup:

View file

@ -20,8 +20,8 @@
******************************************************************************/
#ifndef __DC_CHATLIST_PRIVATE_H__
#define __DC_CHATLIST_PRIVATE_H__
#ifndef __DC_CHATLIST_H__
#define __DC_CHATLIST_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -32,10 +32,10 @@ struct _dc_chatlist
{
/** @privatesection */
uint32_t m_magic;
dc_context_t* m_context; /**< The mailbox, the chatlist belongs to */
#define MR_CHATLIST_IDS_PER_RESULT 2
dc_context_t* m_context; /**< The mailbox, the chatlist belongs to */
#define DC_CHATLIST_IDS_PER_RESULT 2
size_t m_cnt;
dc_array_t* m_chatNlastmsg_ids;
dc_array_t* m_chatNlastmsg_ids;
};
@ -45,4 +45,4 @@ int dc_chatlist_load_from_db__ (dc_chatlist_t*, int listflags, con
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __DC_CHATLIST_PRIVATE_H__ */
#endif /* __DC_CHATLIST_H__ */

View file

@ -90,7 +90,7 @@ static void moz_autoconfigure_starttag_cb(void* userdata, const char* tag, char*
const char* p1;
if( strcmp(tag, "incomingserver")==0 ) {
moz_ac->m_tag_server = (moz_ac->m_out_imap_set==0 && (p1=mrattr_find(attr, "type"))!=NULL && strcasecmp(p1, "imap")==0)? MOZ_SERVER_IMAP : 0;
moz_ac->m_tag_server = (moz_ac->m_out_imap_set==0 && (p1=dc_attr_find(attr, "type"))!=NULL && strcasecmp(p1, "imap")==0)? MOZ_SERVER_IMAP : 0;
moz_ac->m_tag_config = 0;
}
else if( strcmp(tag, "outgoingserver") == 0 ) {
@ -120,9 +120,9 @@ static void moz_autoconfigure_text_cb(void* userdata, const char* text, int len)
case MOZ_PORT: moz_ac->m_out->m_mail_port = atoi(val); break;
case MOZ_USERNAME: free(moz_ac->m_out->m_mail_user); moz_ac->m_out->m_mail_user = val; val = NULL; break;
case MOZ_SOCKETTYPE:
if( strcasecmp(val, "ssl")==0 ) { moz_ac->m_out->m_server_flags |=MR_IMAP_SOCKET_SSL; }
if( strcasecmp(val, "starttls")==0 ) { moz_ac->m_out->m_server_flags |=MR_IMAP_SOCKET_STARTTLS; }
if( strcasecmp(val, "plain")==0 ) { moz_ac->m_out->m_server_flags |=MR_IMAP_SOCKET_PLAIN; }
if( strcasecmp(val, "ssl")==0 ) { moz_ac->m_out->m_server_flags |=DC_LP_IMAP_SOCKET_SSL; }
if( strcasecmp(val, "starttls")==0 ) { moz_ac->m_out->m_server_flags |=DC_LP_IMAP_SOCKET_STARTTLS; }
if( strcasecmp(val, "plain")==0 ) { moz_ac->m_out->m_server_flags |=DC_LP_IMAP_SOCKET_PLAIN; }
break;
}
}
@ -132,9 +132,9 @@ static void moz_autoconfigure_text_cb(void* userdata, const char* text, int len)
case MOZ_PORT: moz_ac->m_out->m_send_port = atoi(val); break;
case MOZ_USERNAME: free(moz_ac->m_out->m_send_user); moz_ac->m_out->m_send_user = val; val = NULL; break;
case MOZ_SOCKETTYPE:
if( strcasecmp(val, "ssl")==0 ) { moz_ac->m_out->m_server_flags |=MR_SMTP_SOCKET_SSL; }
if( strcasecmp(val, "starttls")==0 ) { moz_ac->m_out->m_server_flags |=MR_SMTP_SOCKET_STARTTLS; }
if( strcasecmp(val, "plain")==0 ) { moz_ac->m_out->m_server_flags |=MR_SMTP_SOCKET_PLAIN; }
if( strcasecmp(val, "ssl")==0 ) { moz_ac->m_out->m_server_flags |=DC_LP_SMTP_SOCKET_SSL; }
if( strcasecmp(val, "starttls")==0 ) { moz_ac->m_out->m_server_flags |=DC_LP_SMTP_SOCKET_STARTTLS; }
if( strcasecmp(val, "plain")==0 ) { moz_ac->m_out->m_server_flags |=DC_LP_SMTP_SOCKET_PLAIN; }
break;
}
}
@ -283,15 +283,15 @@ static void outlk_autodiscover_endtag_cb(void* userdata, const char* tag)
if( strcasecmp(outlk_ad->m_config[OUTLK_TYPE], "imap")==0 && outlk_ad->m_out_imap_set==0 ) {
outlk_ad->m_out->m_mail_server = dc_strdup_keep_null(outlk_ad->m_config[OUTLK_SERVER]);
outlk_ad->m_out->m_mail_port = port;
if( ssl_on ) { outlk_ad->m_out->m_server_flags |= MR_IMAP_SOCKET_SSL; }
else if( ssl_off ) { outlk_ad->m_out->m_server_flags |= MR_IMAP_SOCKET_PLAIN; }
if( ssl_on ) { outlk_ad->m_out->m_server_flags |= DC_LP_IMAP_SOCKET_SSL; }
else if( ssl_off ) { outlk_ad->m_out->m_server_flags |= DC_LP_IMAP_SOCKET_PLAIN; }
outlk_ad->m_out_imap_set = 1;
}
else if( strcasecmp(outlk_ad->m_config[OUTLK_TYPE], "smtp")==0 && outlk_ad->m_out_smtp_set==0 ) {
outlk_ad->m_out->m_send_server = dc_strdup_keep_null(outlk_ad->m_config[OUTLK_SERVER]);
outlk_ad->m_out->m_send_port = port;
if( ssl_on ) { outlk_ad->m_out->m_server_flags |= MR_SMTP_SOCKET_SSL; }
else if( ssl_off ) { outlk_ad->m_out->m_server_flags |= MR_SMTP_SOCKET_PLAIN; }
if( ssl_on ) { outlk_ad->m_out->m_server_flags |= DC_LP_SMTP_SOCKET_SSL; }
else if( ssl_off ) { outlk_ad->m_out->m_server_flags |= DC_LP_SMTP_SOCKET_PLAIN; }
outlk_ad->m_out_smtp_set = 1;
}
}
@ -533,7 +533,7 @@ void dc_job_do_DC_JOB_CONFIGURE_IMAP(dc_context_t* context, dc_job_t* job)
{
/* NB: Checking GMa'l too often (<10 Minutes) may result in blocking, says https://github.com/itprojects/InboxPager/blob/HEAD/README.md#gmail-configuration
Also note https://www.google.com/settings/security/lesssecureapps */
param->m_server_flags |= MR_AUTH_XOAUTH2 | MR_NO_EXTRA_IMAP_UPLOAD | MR_NO_MOVE_TO_CHATS;
param->m_server_flags |= DC_LP_AUTH_XOAUTH2 | DC_NO_EXTRA_IMAP_UPLOAD | DC_NO_MOVE_TO_CHATS;
}
@ -552,7 +552,7 @@ void dc_job_do_DC_JOB_CONFIGURE_IMAP(dc_context_t* context, dc_job_t* job)
}
if( param->m_mail_port == 0 ) {
param->m_mail_port = (param->m_server_flags&(MR_IMAP_SOCKET_STARTTLS|MR_IMAP_SOCKET_PLAIN))? TYPICAL_IMAP_STARTTLS_PORT : TYPICAL_IMAP_SSL_PORT;
param->m_mail_port = (param->m_server_flags&(DC_LP_IMAP_SOCKET_STARTTLS|DC_LP_IMAP_SOCKET_PLAIN))? TYPICAL_IMAP_STARTTLS_PORT : TYPICAL_IMAP_SSL_PORT;
}
if( param->m_mail_user == NULL ) {
@ -567,8 +567,8 @@ void dc_job_do_DC_JOB_CONFIGURE_IMAP(dc_context_t* context, dc_job_t* job)
}
if( param->m_send_port == 0 ) {
param->m_send_port = (param->m_server_flags&MR_SMTP_SOCKET_STARTTLS)? TYPICAL_SMTP_STARTTLS_PORT :
((param->m_server_flags&MR_SMTP_SOCKET_PLAIN)? TYPICAL_SMTP_PLAIN_PORT : TYPICAL_SMTP_SSL_PORT);
param->m_send_port = (param->m_server_flags&DC_LP_SMTP_SOCKET_STARTTLS)? TYPICAL_SMTP_STARTTLS_PORT :
((param->m_server_flags&DC_LP_SMTP_SOCKET_PLAIN)? TYPICAL_SMTP_PLAIN_PORT : TYPICAL_SMTP_SSL_PORT);
}
if( param->m_send_user == NULL && param->m_mail_user ) {
@ -579,23 +579,23 @@ void dc_job_do_DC_JOB_CONFIGURE_IMAP(dc_context_t* context, dc_job_t* job)
param->m_send_pw = dc_strdup(param->m_mail_pw);
}
if( !dc_exactly_one_bit_set(param->m_server_flags&MR_AUTH_FLAGS) )
if( !dc_exactly_one_bit_set(param->m_server_flags&DC_LP_AUTH_FLAGS) )
{
param->m_server_flags &= ~MR_AUTH_FLAGS;
param->m_server_flags |= MR_AUTH_NORMAL;
param->m_server_flags &= ~DC_LP_AUTH_FLAGS;
param->m_server_flags |= DC_LP_AUTH_NORMAL;
}
if( !dc_exactly_one_bit_set(param->m_server_flags&MR_IMAP_SOCKET_FLAGS) )
if( !dc_exactly_one_bit_set(param->m_server_flags&DC_LP_IMAP_SOCKET_FLAGS) )
{
param->m_server_flags &= ~MR_IMAP_SOCKET_FLAGS;
param->m_server_flags |= (param->m_send_port==TYPICAL_IMAP_STARTTLS_PORT? MR_IMAP_SOCKET_STARTTLS : MR_IMAP_SOCKET_SSL);
param->m_server_flags &= ~DC_LP_IMAP_SOCKET_FLAGS;
param->m_server_flags |= (param->m_send_port==TYPICAL_IMAP_STARTTLS_PORT? DC_LP_IMAP_SOCKET_STARTTLS : DC_LP_IMAP_SOCKET_SSL);
}
if( !dc_exactly_one_bit_set(param->m_server_flags&MR_SMTP_SOCKET_FLAGS) )
if( !dc_exactly_one_bit_set(param->m_server_flags&DC_LP_SMTP_SOCKET_FLAGS) )
{
param->m_server_flags &= ~MR_SMTP_SOCKET_FLAGS;
param->m_server_flags |= ( param->m_send_port==TYPICAL_SMTP_STARTTLS_PORT? MR_SMTP_SOCKET_STARTTLS :
(param->m_send_port==TYPICAL_SMTP_PLAIN_PORT? MR_SMTP_SOCKET_PLAIN: MR_SMTP_SOCKET_SSL) );
param->m_server_flags &= ~DC_LP_SMTP_SOCKET_FLAGS;
param->m_server_flags |= ( param->m_send_port==TYPICAL_SMTP_STARTTLS_PORT? DC_LP_SMTP_SOCKET_STARTTLS :
(param->m_send_port==TYPICAL_SMTP_PLAIN_PORT? DC_LP_SMTP_SOCKET_PLAIN: DC_LP_SMTP_SOCKET_SSL) );
}
@ -636,8 +636,8 @@ void dc_job_do_DC_JOB_CONFIGURE_IMAP(dc_context_t* context, dc_job_t* job)
PROGRESS(850)
param->m_server_flags &= ~MR_SMTP_SOCKET_FLAGS;
param->m_server_flags |= MR_SMTP_SOCKET_STARTTLS;
param->m_server_flags &= ~DC_LP_SMTP_SOCKET_FLAGS;
param->m_server_flags |= DC_LP_SMTP_SOCKET_STARTTLS;
param->m_send_port = TYPICAL_SMTP_STARTTLS_PORT;
{ char* r = dc_loginparam_get_readable(param); dc_log_info(context, 0, "Trying: %s", r); free(r); }

View file

@ -25,7 +25,7 @@
#include "dc_apeerstate.h"
#define MR_CONTACT_MAGIC 0x0c047ac7
#define DC_CONTACT_MAGIC 0x0c047ac7
/**
@ -45,7 +45,7 @@ dc_contact_t* dc_contact_new(dc_context_t* mailbox)
exit(19); /* cannot allocate little memory, unrecoverable error */
}
ths->m_magic = MR_CONTACT_MAGIC;
ths->m_magic = DC_CONTACT_MAGIC;
ths->m_context = mailbox;
return ths;
@ -63,7 +63,7 @@ dc_contact_t* dc_contact_new(dc_context_t* mailbox)
*/
void dc_contact_unref(dc_contact_t* contact)
{
if( contact==NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
if( contact==NULL || contact->m_magic != DC_CONTACT_MAGIC ) {
return;
}
@ -86,7 +86,7 @@ void dc_contact_unref(dc_contact_t* contact)
*/
void dc_contact_empty(dc_contact_t* contact)
{
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
if( contact == NULL || contact->m_magic != DC_CONTACT_MAGIC ) {
return;
}
@ -122,7 +122,7 @@ void dc_contact_empty(dc_contact_t* contact)
*/
uint32_t dc_contact_get_id(const dc_contact_t* contact)
{
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
if( contact == NULL || contact->m_magic != DC_CONTACT_MAGIC ) {
return 0;
}
return contact->m_id;
@ -140,7 +140,7 @@ uint32_t dc_contact_get_id(const dc_contact_t* contact)
*/
char* dc_contact_get_addr(const dc_contact_t* contact)
{
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
if( contact == NULL || contact->m_magic != DC_CONTACT_MAGIC ) {
return dc_strdup(NULL);
}
@ -164,7 +164,7 @@ char* dc_contact_get_addr(const dc_contact_t* contact)
*/
char* dc_contact_get_name(const dc_contact_t* contact)
{
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
if( contact == NULL || contact->m_magic != DC_CONTACT_MAGIC ) {
return dc_strdup(NULL);
}
@ -187,7 +187,7 @@ char* dc_contact_get_name(const dc_contact_t* contact)
*/
char* dc_contact_get_display_name(const dc_contact_t* contact)
{
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
if( contact == NULL || contact->m_magic != DC_CONTACT_MAGIC ) {
return dc_strdup(NULL);
}
@ -218,7 +218,7 @@ char* dc_contact_get_display_name(const dc_contact_t* contact)
*/
char* dc_contact_get_name_n_addr(const dc_contact_t* contact)
{
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
if( contact == NULL || contact->m_magic != DC_CONTACT_MAGIC ) {
return dc_strdup(NULL);
}
@ -243,7 +243,7 @@ char* dc_contact_get_name_n_addr(const dc_contact_t* contact)
*/
char* dc_contact_get_first_name(const dc_contact_t* contact)
{
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
if( contact == NULL || contact->m_magic != DC_CONTACT_MAGIC ) {
return dc_strdup(NULL);
}
@ -268,7 +268,7 @@ char* dc_contact_get_first_name(const dc_contact_t* contact)
*/
int dc_contact_is_blocked(const dc_contact_t* contact)
{
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
if( contact == NULL || contact->m_magic != DC_CONTACT_MAGIC ) {
return 0;
}
return contact->m_blocked;
@ -279,7 +279,7 @@ int dc_contact_is_verified__(const dc_contact_t* contact, const dc_apeerstate_t*
{
int contact_verified = DC_NOT_VERIFIED;
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
if( contact == NULL || contact->m_magic != DC_CONTACT_MAGIC ) {
goto cleanup;
}
@ -314,7 +314,7 @@ int dc_contact_is_verified(const dc_contact_t* contact)
int locked = 0;
dc_apeerstate_t* peerstate = NULL;
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
if( contact == NULL || contact->m_magic != DC_CONTACT_MAGIC ) {
goto cleanup;
}
@ -464,7 +464,7 @@ int dc_contact_load_from_db__(dc_contact_t* ths, dc_sqlite3_t* sql, uint32_t con
int success = 0;
sqlite3_stmt* stmt;
if( ths == NULL || ths->m_magic != MR_CONTACT_MAGIC || sql == NULL ) {
if( ths == NULL || ths->m_magic != DC_CONTACT_MAGIC || sql == NULL ) {
return 0;
}

View file

@ -3886,8 +3886,8 @@ char* dc_get_contact_encrinfo(dc_context_t* context, uint32_t contact_id)
else
{
// No E2E available
if( !(loginparam->m_server_flags&MR_IMAP_SOCKET_PLAIN)
&& !(loginparam->m_server_flags&MR_SMTP_SOCKET_PLAIN) )
if( !(loginparam->m_server_flags&DC_LP_IMAP_SOCKET_PLAIN)
&& !(loginparam->m_server_flags&DC_LP_SMTP_SOCKET_PLAIN) )
{
p = dc_stock_str(DC_STR_ENCR_TRANSP); dc_strbuilder_cat(&ret, p); free(p);
}
@ -4207,7 +4207,7 @@ char* dc_get_msg_info(dc_context_t* context, uint32_t msg_id)
#endif
dc_trim(rawtxt);
dc_truncate_str(rawtxt, MR_MAX_GET_INFO_LEN);
dc_truncate_str(rawtxt, DC_MAX_GET_INFO_LEN);
/* add time */
dc_strbuilder_cat(&ret, "Sent: ");
@ -4262,7 +4262,7 @@ char* dc_get_msg_info(dc_context_t* context, uint32_t msg_id)
p = NULL;
int e2ee_errors;
if( (e2ee_errors=dc_param_get_int(msg->m_param, DC_PARAM_ERRONEOUS_E2EE, 0)) ) {
if( e2ee_errors&MRE2EE_NO_VALID_SIGNATURE ) {
if( e2ee_errors&DC_E2EE_NO_VALID_SIGNATURE ) {
p = dc_strdup("Encrypted, no valid signature");
}
}

View file

@ -33,7 +33,6 @@ extern "C" {
#include <pthread.h>
#include <libetpan/libetpan.h>
#include "deltachat.h"
#include "mrmailbox.h"
#include "dc_sqlite3.h"
#include "dc_tools.h"
#include "dc_strbuilder.h"

View file

@ -69,7 +69,7 @@ static void dehtml_starttag_cb(void* userdata, const char* tag, char** attr)
else if( strcmp(tag, "a")==0 )
{
free(dehtml->m_last_href);
dehtml->m_last_href = dc_strdup_keep_null(mrattr_find(attr, "href"));
dehtml->m_last_href = dc_strdup_keep_null(dc_attr_find(attr, "href"));
if( dehtml->m_last_href ) {
dc_strbuilder_cat(&dehtml->m_strbuilder, "[");
}

View file

@ -133,7 +133,7 @@ void dc_hash_init(dc_hash_t *pNew, int keyClass, int copyKey)
*/
void dc_hash_clear(dc_hash_t *pH)
{
mrhashelem_t *elem; /* For looping over all elements of the table */
dc_hashelem_t *elem; /* For looping over all elements of the table */
if( pH == NULL ) {
return;
@ -146,7 +146,7 @@ void dc_hash_clear(dc_hash_t *pH)
pH->htsize = 0;
while( elem )
{
mrhashelem_t *next_elem = elem->next;
dc_hashelem_t *next_elem = elem->next;
if( pH->copyKey && elem->pKey )
{
sjhashFree(elem->pKey);
@ -271,9 +271,9 @@ static int (*compareFunction(int keyClass))(const void*,int,const void*,int)
*/
static void insertElement(dc_hash_t *pH, /* The complete hash table */
struct _ht *pEntry, /* The entry into which pNew is inserted */
mrhashelem_t *pNew) /* The element to be inserted */
dc_hashelem_t *pNew) /* The element to be inserted */
{
mrhashelem_t *pHead; /* First element already in pEntry */
dc_hashelem_t *pHead; /* First element already in pEntry */
pHead = pEntry->chain;
if( pHead )
{
@ -303,7 +303,7 @@ static void insertElement(dc_hash_t *pH, /* The complete hash table */
static void rehash(dc_hash_t *pH, int new_size)
{
struct _ht *new_ht; /* The new hash table */
mrhashelem_t *elem, *next_elem; /* For looping over existing elements */
dc_hashelem_t *elem, *next_elem; /* For looping over existing elements */
int (*xHash)(const void*,int); /* The hash function */
assert( (new_size & (new_size-1))==0 );
@ -327,12 +327,12 @@ static void rehash(dc_hash_t *pH, int new_size)
* hash table that matches the given key. The hash for this key has
* already been computed and is passed as the 4th parameter.
*/
static mrhashelem_t *findElementGivenHash(const dc_hash_t *pH, /* The pH to be searched */
static dc_hashelem_t *findElementGivenHash(const dc_hash_t *pH, /* The pH to be searched */
const void *pKey, /* The key we are searching for */
int nKey,
int h) /* The hash for this key. */
{
mrhashelem_t *elem; /* Used to loop thru the element list */
dc_hashelem_t *elem; /* Used to loop thru the element list */
int count; /* Number of elements left to test */
int (*xCompare)(const void*,int,const void*,int); /* comparison function */
@ -360,7 +360,7 @@ static mrhashelem_t *findElementGivenHash(const dc_hash_t *pH, /* The pH to be
* element and a hash on the element's key.
*/
static void removeElementGivenHash(dc_hash_t *pH, /* The pH containing "elem" */
mrhashelem_t* elem, /* The element to be removed from the pH */
dc_hashelem_t* elem, /* The element to be removed from the pH */
int h) /* Hash value for the element */
{
struct _ht *pEntry;
@ -411,7 +411,7 @@ static void removeElementGivenHash(dc_hash_t *pH, /* The pH containing "
void* dc_hash_find(const dc_hash_t *pH, const void *pKey, int nKey)
{
int h; /* A hash on key */
mrhashelem_t *elem; /* The element that matches key */
dc_hashelem_t *elem; /* The element that matches key */
int (*xHash)(const void*,int); /* The hash function */
if( pH==0 || pH->ht==0 ) return 0;
@ -444,8 +444,8 @@ void* dc_hash_insert(dc_hash_t *pH, const void *pKey, int nKey, void *data)
{
int hraw; /* Raw hash value of the key */
int h; /* the hash of the key modulo hash table size */
mrhashelem_t *elem; /* Used to loop thru the element list */
mrhashelem_t *new_elem; /* New element added to the pH */
dc_hashelem_t *elem; /* Used to loop thru the element list */
dc_hashelem_t *new_elem; /* New element added to the pH */
int (*xHash)(const void*,int); /* The hash function */
assert( pH!=0 );
@ -472,7 +472,7 @@ void* dc_hash_insert(dc_hash_t *pH, const void *pKey, int nKey, void *data)
if( data==0 ) return 0;
new_elem = (mrhashelem_t*)sjhashMalloc( sizeof(mrhashelem_t) );
new_elem = (dc_hashelem_t*)sjhashMalloc( sizeof(dc_hashelem_t) );
if( new_elem==0 ) return data;

View file

@ -30,7 +30,7 @@ extern "C"
/* Forward declarations of structures.
*/
typedef struct mrhashelem_t mrhashelem_t;
typedef struct dc_hashelem_t dc_hashelem_t;
/* A complete hash table is an instance of the following structure.
@ -46,12 +46,12 @@ typedef struct dc_hash_t
char keyClass; /* SJHASH_INT, _POINTER, _STRING, _BINARY */
char copyKey; /* True if copy of key made on insert */
int count; /* Number of entries in this table */
mrhashelem_t* first; /* The first element of the array */
dc_hashelem_t *first; /* The first element of the array */
int htsize; /* Number of buckets in the hash table */
struct _ht
{ /* the hash table */
int count; /* Number of entries with this hash */
mrhashelem_t* chain; /* Pointer to first entry with this hash */
dc_hashelem_t *chain; /* Pointer to first entry with this hash */
} *ht;
} dc_hash_t;
@ -62,13 +62,13 @@ typedef struct dc_hash_t
* Again, this structure is intended to be opaque, but it can't really
* be opaque because it is used by macros.
*/
typedef struct mrhashelem_t
typedef struct dc_hashelem_t
{
mrhashelem_t *next, *prev; /* Next and previous elements in the table */
dc_hashelem_t *next, *prev; /* Next and previous elements in the table */
void* data; /* Data associated with this element */
void* pKey; /* Key associated with this element */
int nKey; /* Key associated with this element */
} mrhashelem_t;
} dc_hashelem_t;
/*

View file

@ -190,12 +190,12 @@ static int get_folder_meaning(const dc_imap_t* ths, struct mailimap_mbx_list_fla
}
typedef struct mrimapfolder_t
typedef struct dc_imapfolder_t
{
char* m_name_to_select;
char* m_name_utf8;
int m_meaning;
} mrimapfolder_t;
} dc_imapfolder_t;
static clist* list_folders__(dc_imap_t* ths)
@ -240,7 +240,7 @@ static clist* list_folders__(dc_imap_t* ths)
ths->m_imap_delimiter = imap_folder->mb_delimiter;
}
mrimapfolder_t* ret_folder = calloc(1, sizeof(mrimapfolder_t));
dc_imapfolder_t* ret_folder = calloc(1, sizeof(dc_imapfolder_t));
if( strcasecmp(imap_folder->mb_name, "INBOX")==0 ) {
/* Force upper case INBOX as we also use it directly this way; a unified name is needed as we use the folder name to remember the last uid.
@ -266,7 +266,7 @@ static clist* list_folders__(dc_imap_t* ths)
if( !xlist_works ) {
for( iter1 = clist_begin(ret_list); iter1 != NULL ; iter1 = clist_next(iter1) )
{
mrimapfolder_t* ret_folder = (struct mrimapfolder_t*)clist_content(iter1);
dc_imapfolder_t* ret_folder = (struct dc_imapfolder_t*)clist_content(iter1);
ret_folder->m_meaning = get_folder_meaning(ths, NULL, ret_folder->m_name_utf8, true);
}
}
@ -284,7 +284,7 @@ static void free_folders(clist* folders)
if( folders ) {
clistiter* iter1;
for( iter1 = clist_begin(folders); iter1 != NULL ; iter1 = clist_next(iter1) ) {
mrimapfolder_t* ret_folder = (struct mrimapfolder_t*)clist_content(iter1);
dc_imapfolder_t* ret_folder = (struct dc_imapfolder_t*)clist_content(iter1);
free(ret_folder->m_name_to_select);
free(ret_folder->m_name_utf8);
free(ret_folder);
@ -323,7 +323,7 @@ static int init_chat_folders__(dc_imap_t* ths)
snprintf(fallback_folder, sizeof(fallback_folder), "INBOX%c%s", ths->m_imap_delimiter, DC_CHATS_FOLDER);
for( iter1 = clist_begin(folder_list); iter1 != NULL ; iter1 = clist_next(iter1) ) {
mrimapfolder_t* folder = (struct mrimapfolder_t*)clist_content(iter1);
dc_imapfolder_t* folder = (struct dc_imapfolder_t*)clist_content(iter1);
if( strcmp(folder->m_name_utf8, DC_CHATS_FOLDER)==0 || strcmp(folder->m_name_utf8, fallback_folder)==0 ) {
chats_folder = dc_strdup(folder->m_name_to_select);
break;
@ -336,7 +336,7 @@ static int init_chat_folders__(dc_imap_t* ths)
}
}
if( chats_folder == NULL && (ths->m_server_flags&MR_NO_MOVE_TO_CHATS)==0 ) {
if( chats_folder == NULL && (ths->m_server_flags&DC_NO_MOVE_TO_CHATS)==0 ) {
dc_log_info(ths->m_context, 0, "Creating IMAP-folder \"%s\"...", DC_CHATS_FOLDER);
int r = mailimap_create(ths->m_hEtpan, DC_CHATS_FOLDER);
if( is_error(ths, r) ) {
@ -440,7 +440,7 @@ static uint32_t search_uid__(dc_imap_t* imap, const char* message_id)
uint32_t uid = 0;
for( cur = clist_begin(folders); cur != NULL ; cur = clist_next(cur) )
{
mrimapfolder_t* folder = (mrimapfolder_t*)clist_content(cur);
dc_imapfolder_t* folder = (dc_imapfolder_t*)clist_content(cur);
if( select_folder__(imap, folder->m_name_to_select) )
{
int r = mailimap_uid_search(imap->m_hEtpan, "utf-8", key, &search_result);
@ -605,7 +605,7 @@ static void peek_body(struct mailimap_msg_att* msg_att, char** p_msg, size_t* p_
if( flag )
{
if( flag->fl_type == MAILIMAP_FLAG_SEEN ) {
*flags |= MR_IMAP_SEEN;
*flags |= DC_IMAP_SEEN;
}
else if( flag->fl_type == MAILIMAP_FLAG_DELETED ) {
*deleted = 1;
@ -831,7 +831,7 @@ static int fetch_from_all_folders(dc_imap_t* ths)
has the most recent mails. Moreover, this is for speed reasons, as the other folders only have few new messages. */
for( cur = clist_begin(folder_list); cur != NULL ; cur = clist_next(cur) )
{
mrimapfolder_t* folder = (mrimapfolder_t*)clist_content(cur);
dc_imapfolder_t* folder = (dc_imapfolder_t*)clist_content(cur);
if( folder->m_meaning == MEANING_INBOX ) {
total_cnt += fetch_from_single_folder(ths, folder->m_name_to_select);
}
@ -839,7 +839,7 @@ static int fetch_from_all_folders(dc_imap_t* ths)
for( cur = clist_begin(folder_list); cur != NULL ; cur = clist_next(cur) )
{
mrimapfolder_t* folder = (mrimapfolder_t*)clist_content(cur);
dc_imapfolder_t* folder = (dc_imapfolder_t*)clist_content(cur);
if( folder->m_meaning == MEANING_IGNORE ) {
dc_log_info(ths->m_context, 0, "Ignoring \"%s\".", folder->m_name_utf8);
}
@ -1051,9 +1051,9 @@ static int setup_handle_if_needed__(dc_imap_t* ths)
ths->m_hEtpan = mailimap_new(0, NULL);
mailimap_set_timeout(ths->m_hEtpan, MR_IMAP_TIMEOUT_SEC);
mailimap_set_timeout(ths->m_hEtpan, DC_IMAP_TIMEOUT_SEC);
if( ths->m_server_flags&(MR_IMAP_SOCKET_STARTTLS|MR_IMAP_SOCKET_PLAIN) )
if( ths->m_server_flags&(DC_LP_IMAP_SOCKET_STARTTLS|DC_LP_IMAP_SOCKET_PLAIN) )
{
r = mailimap_socket_connect(ths->m_hEtpan, ths->m_imap_server, ths->m_imap_port);
if( is_error(ths, r) ) {
@ -1061,7 +1061,7 @@ static int setup_handle_if_needed__(dc_imap_t* ths)
goto cleanup;
}
if( ths->m_server_flags&MR_IMAP_SOCKET_STARTTLS )
if( ths->m_server_flags&DC_LP_IMAP_SOCKET_STARTTLS )
{
r = mailimap_socket_starttls(ths->m_hEtpan);
if( is_error(ths, r) ) {
@ -1086,7 +1086,7 @@ static int setup_handle_if_needed__(dc_imap_t* ths)
}
/* TODO: There are more authorisation types, see mailcore2/MCIMAPSession.cpp, however, I'm not sure of they are really all needed */
/*if( ths->m_server_flags&MR_AUTH_XOAUTH2 )
/*if( ths->m_server_flags&DC_LP_AUTH_XOAUTH2 )
{
//TODO: Support XOAUTH2, we "just" need to get the token someway. If we do so, there is no more need for the user to enable
//https://www.google.com/settings/security/lesssecureapps - however, maybe this is also not needed if the user had enabled 2-factor-authorisation.
@ -1099,7 +1099,7 @@ static int setup_handle_if_needed__(dc_imap_t* ths)
}
else*/
{
/* MR_AUTH_NORMAL or no auth flag set */
/* DC_LP_AUTH_NORMAL or no auth flag set */
r = mailimap_login(ths->m_hEtpan, ths->m_imap_user, ths->m_imap_pw);
}
@ -1274,7 +1274,7 @@ int dc_imap_is_connected(dc_imap_t* ths)
******************************************************************************/
dc_imap_t* dc_imap_new(mr_get_config_t get_config, mr_set_config_t set_config, mr_receive_imf_t receive_imf, void* userData, dc_context_t* mailbox)
dc_imap_t* dc_imap_new(dc_get_config_t get_config, dc_set_config_t set_config, dc_receive_imf_t receive_imf, void* userData, dc_context_t* mailbox)
{
dc_imap_t* ths = NULL;
@ -1478,7 +1478,7 @@ int dc_imap_markseen_msg(dc_imap_t* ths, const char* folder, uint32_t server_uid
dc_log_info(ths->m_context, 0, "Message marked as seen.");
if( (ms_flags&MR_MS_SET_MDNSent_FLAG)
if( (ms_flags&DC_MS_SET_MDNSent_FLAG)
&& ths->m_hEtpan->imap_selection_info!=NULL && ths->m_hEtpan->imap_selection_info->sel_perm_flags!=NULL )
{
/* Check if the folder can handle the `$MDNSent` flag (see RFC 3503). If so, and not set: set the flags and return this information.
@ -1512,28 +1512,28 @@ int dc_imap_markseen_msg(dc_imap_t* ths, const char* folder, uint32_t server_uid
if( cur ) {
if( !peek_flag_keyword((struct mailimap_msg_att*)clist_content(cur), "$MDNSent") ) {
add_flag__(ths, server_uid, mailimap_flag_new_flag_keyword(dc_strdup("$MDNSent")));
*ret_ms_flags |= MR_MS_MDNSent_JUST_SET;
*ret_ms_flags |= DC_MS_MDNSent_JUST_SET;
}
}
mailimap_fetch_list_free(fetch_result);
}
dc_log_info(ths->m_context, 0, ((*ret_ms_flags)&MR_MS_MDNSent_JUST_SET)? "$MDNSent just set and MDN will be sent." : "$MDNSent already set and MDN already sent.");
dc_log_info(ths->m_context, 0, ((*ret_ms_flags)&DC_MS_MDNSent_JUST_SET)? "$MDNSent just set and MDN will be sent." : "$MDNSent already set and MDN already sent.");
}
else
{
*ret_ms_flags |= MR_MS_MDNSent_JUST_SET;
*ret_ms_flags |= DC_MS_MDNSent_JUST_SET;
dc_log_info(ths->m_context, 0, "Cannot store $MDNSent flags, risk sending duplicate MDN.");
}
}
if( (ms_flags&MR_MS_ALSO_MOVE) && (ths->m_server_flags&MR_NO_MOVE_TO_CHATS)==0 )
if( (ms_flags&DC_MS_ALSO_MOVE) && (ths->m_server_flags&DC_NO_MOVE_TO_CHATS)==0 )
{
init_chat_folders__(ths);
if( ths->m_moveto_folder && strcmp(folder, ths->m_moveto_folder)==0 )
{
dc_log_info(ths->m_context, 0, "Message %s/%i is already in %s...", folder, (int)server_uid, ths->m_moveto_folder);
/* avoid deadlocks as moving messages in the same folder may be result in a new server_uid and the state "fresh" -
we will catch these messages again on the next poll, try to move them away and so on, see also (***) in mrmailbox.c */
we will catch these messages again on the next poll, try to move them away and so on, see also (***) in dc_receive_imf.c */
}
else if( ths->m_moveto_folder )
{

View file

@ -35,11 +35,12 @@ extern "C" {
typedef struct dc_loginparam_t dc_loginparam_t;
typedef struct dc_imap_t dc_imap_t;
#define MR_IMAP_SEEN 0x0001L
typedef char* (*mr_get_config_t) (dc_imap_t*, const char*, const char*);
typedef void (*mr_set_config_t) (dc_imap_t*, const char*, const char*);
typedef void (*mr_receive_imf_t) (dc_imap_t*, const char* imf_raw_not_terminated, size_t imf_raw_bytes, const char* server_folder, uint32_t server_uid, uint32_t flags);
typedef char* (*dc_get_config_t) (dc_imap_t*, const char*, const char*);
typedef void (*dc_set_config_t) (dc_imap_t*, const char*, const char*);
#define DC_IMAP_SEEN 0x0001L
typedef void (*dc_receive_imf_t) (dc_imap_t*, const char* imf_raw_not_terminated, size_t imf_raw_bytes, const char* server_folder, uint32_t server_uid, uint32_t flags);
/**
@ -82,9 +83,9 @@ typedef struct dc_imap_t
struct mailimap_fetch_type* m_fetch_type_body;
struct mailimap_fetch_type* m_fetch_type_flags;
mr_get_config_t m_get_config;
mr_set_config_t m_set_config;
mr_receive_imf_t m_receive_imf;
dc_get_config_t m_get_config;
dc_set_config_t m_set_config;
dc_receive_imf_t m_receive_imf;
void* m_userData;
dc_context_t* m_context;
@ -94,7 +95,7 @@ typedef struct dc_imap_t
} dc_imap_t;
dc_imap_t* dc_imap_new (mr_get_config_t, mr_set_config_t, mr_receive_imf_t, void* userData, dc_context_t*);
dc_imap_t* dc_imap_new (dc_get_config_t, dc_set_config_t, dc_receive_imf_t, void* userData, dc_context_t*);
void dc_imap_unref (dc_imap_t*);
int dc_imap_connect (dc_imap_t*, const dc_loginparam_t*);
@ -107,9 +108,9 @@ void dc_imap_interrupt_idle (dc_imap_t*);
int dc_imap_append_msg (dc_imap_t*, time_t timestamp, const char* data_not_terminated, size_t data_bytes, char** ret_server_folder, uint32_t* ret_server_uid);
#define MR_MS_ALSO_MOVE 0x01
#define MR_MS_SET_MDNSent_FLAG 0x02
#define MR_MS_MDNSent_JUST_SET 0x10
#define DC_MS_ALSO_MOVE 0x01
#define DC_MS_SET_MDNSent_FLAG 0x02
#define DC_MS_MDNSent_JUST_SET 0x10
int dc_imap_markseen_msg (dc_imap_t*, const char* folder, uint32_t server_uid, int ms_flags, char** ret_server_folder, uint32_t* ret_server_uid, int* ret_ms_flags); /* only returns 0 on connection problems; we should try later again in this case */
int dc_imap_delete_msg (dc_imap_t*, const char* rfc724_mid, const char* folder, uint32_t server_uid); /* only returns 0 on connection problems; we should try later again in this case */

View file

@ -511,7 +511,7 @@ char* dc_initiate_key_transfer(dc_context_t* context)
dc_param_set (msg->m_param, DC_PARAM_FILE, setup_file_name);
dc_param_set (msg->m_param, DC_PARAM_MIMETYPE, "application/autocrypt-setup");
dc_param_set_int(msg->m_param, DC_PARAM_CMD, DC_CMD_AUTOCRYPT_SETUP_MESSAGE);
dc_param_set_int(msg->m_param, DC_PARAM_FORCE_PLAINTEXT, MRFP_NO_AUTOCRYPT_HEADER);
dc_param_set_int(msg->m_param, DC_PARAM_FORCE_PLAINTEXT, DC_FP_NO_AUTOCRYPT_HEADER);
CHECK_EXIT
@ -1228,7 +1228,7 @@ int dc_imex(dc_context_t* context, int what, const char* param1, const char* par
goto cleanup;
}
if( what==MR_IMEX_EXPORT_SELF_KEYS || what==MR_IMEX_EXPORT_BACKUP ) {
if( what==DC_IMEX_EXPORT_SELF_KEYS || what==DC_IMEX_EXPORT_BACKUP ) {
/* before we export anything, make sure the private key exists */
if( !dc_ensure_secret_key_exists(context) ) {
dc_log_error(context, 0, "Import/export: Cannot create private key or private key not available.");
@ -1240,25 +1240,25 @@ int dc_imex(dc_context_t* context, int what, const char* param1, const char* par
switch( what )
{
case MR_IMEX_EXPORT_SELF_KEYS:
case DC_IMEX_EXPORT_SELF_KEYS:
if( !export_self_keys(context, param1) ) {
goto cleanup;
}
break;
case MR_IMEX_IMPORT_SELF_KEYS:
case DC_IMEX_IMPORT_SELF_KEYS:
if( !import_self_keys(context, param1) ) {
goto cleanup;
}
break;
case MR_IMEX_EXPORT_BACKUP:
case DC_IMEX_EXPORT_BACKUP:
if( !export_backup(context, param1) ) {
goto cleanup;
}
break;
case MR_IMEX_IMPORT_BACKUP:
case DC_IMEX_IMPORT_BACKUP:
if( !import_backup(context, param1) ) {
goto cleanup;
}
@ -1360,7 +1360,7 @@ char* dc_imex_has_backup(dc_context_t* context, const char* dir_name)
dc_sqlite3_unref(test_sql);
if( (test_sql=dc_sqlite3_new(context/*for logging only*/))!=NULL
&& dc_sqlite3_open__(test_sql, curr_pathNfilename, MR_OPEN_READONLY) )
&& dc_sqlite3_open__(test_sql, curr_pathNfilename, DC_OPEN_READONLY) )
{
time_t curr_backup_time = dc_sqlite3_get_config_int__(test_sql, "backup_time", 0); /* reading the backup time also checks if the database is readable and the table `config` exists */
if( curr_backup_time > 0

View file

@ -252,20 +252,20 @@ static void dc_job_do_DC_JOB_MARKSEEN_MSG_ON_IMAP(dc_context_t* mailbox, dc_job_
/* add an additional job for sending the MDN (here in a thread for fast ui resonses) (an extra job as the MDN has a lower priority) */
if( dc_param_get_int(msg->m_param, DC_PARAM_WANTS_MDN, 0) /* DC_PARAM_WANTS_MDN is set only for one part of a multipart-message */
&& dc_sqlite3_get_config_int__(mailbox->m_sql, "mdns_enabled", DC_MDNS_DEFAULT_ENABLED) ) {
in_ms_flags |= MR_MS_SET_MDNSent_FLAG;
in_ms_flags |= DC_MS_SET_MDNSent_FLAG;
}
dc_sqlite3_unlock(mailbox->m_sql);
locked = 0;
if( msg->m_is_msgrmsg ) {
in_ms_flags |= MR_MS_ALSO_MOVE;
in_ms_flags |= DC_MS_ALSO_MOVE;
}
if( dc_imap_markseen_msg(mailbox->m_imap, msg->m_server_folder, msg->m_server_uid,
in_ms_flags, &new_server_folder, &new_server_uid, &out_ms_flags) != 0 )
{
if( (new_server_folder && new_server_uid) || out_ms_flags&MR_MS_MDNSent_JUST_SET )
if( (new_server_folder && new_server_uid) || out_ms_flags&DC_MS_MDNSent_JUST_SET )
{
dc_sqlite3_lock(mailbox->m_sql);
locked = 1;
@ -275,7 +275,7 @@ static void dc_job_do_DC_JOB_MARKSEEN_MSG_ON_IMAP(dc_context_t* mailbox, dc_job_
dc_update_server_uid__(mailbox, msg->m_rfc724_mid, new_server_folder, new_server_uid);
}
if( out_ms_flags&MR_MS_MDNSent_JUST_SET )
if( out_ms_flags&DC_MS_MDNSent_JUST_SET )
{
dc_job_add(mailbox, DC_JOB_SEND_MDN, msg->m_id, NULL, 0);
}
@ -312,7 +312,7 @@ static void dc_job_do_DC_JOB_MARKSEEN_MDN_ON_IMAP(dc_context_t* mailbox, dc_job_
}
}
if( dc_imap_markseen_msg(mailbox->m_imap, server_folder, server_uid, MR_MS_ALSO_MOVE, &new_server_folder, &new_server_uid, &out_ms_flags) == 0 ) {
if( dc_imap_markseen_msg(mailbox->m_imap, server_folder, server_uid, DC_MS_ALSO_MOVE, &new_server_folder, &new_server_uid, &out_ms_flags) == 0 ) {
dc_job_try_again_later(job, DC_AT_ONCE);
}
@ -391,7 +391,7 @@ static void dc_job_do_DC_JOB_SEND_MSG_TO_SMTP(dc_context_t* mailbox, dc_job_t* j
if( !dc_smtp_send_msg(mailbox->m_smtp, mimefactory.m_recipients_addr, mimefactory.m_out->str, mimefactory.m_out->len) ) {
dc_smtp_disconnect(mailbox->m_smtp);
dc_job_try_again_later(job, DC_AT_ONCE); /* MR_AT_ONCE is only the _initial_ delay, if the second try failes, the delay gets larger */
dc_job_try_again_later(job, DC_AT_ONCE); /* DC_AT_ONCE is only the _initial_ delay, if the second try failes, the delay gets larger */
goto cleanup;
}
}
@ -419,7 +419,7 @@ static void dc_job_do_DC_JOB_SEND_MSG_TO_SMTP(dc_context_t* mailbox, dc_job_t* j
dc_msg_save_param_to_disk__(mimefactory.m_msg);
}
if( (mailbox->m_imap->m_server_flags&MR_NO_EXTRA_IMAP_UPLOAD)==0
if( (mailbox->m_imap->m_server_flags&DC_NO_EXTRA_IMAP_UPLOAD)==0
&& dc_param_get(mimefactory.m_chat->m_param, DC_PARAM_SELFTALK, 0)==0
&& dc_param_get_int(mimefactory.m_msg->m_param, DC_PARAM_CMD, 0)!=DC_CMD_SECUREJOIN_MESSAGE ) {
dc_job_add(mailbox, DC_JOB_SEND_MSG_TO_IMAP, mimefactory.m_msg->m_id, NULL, 0); /* send message to IMAP in another job */
@ -471,7 +471,7 @@ static void dc_job_do_DC_JOB_SEND_MDN(dc_context_t* mailbox, dc_job_t* job)
if( !dc_smtp_send_msg(mailbox->m_smtp, mimefactory.m_recipients_addr, mimefactory.m_out->str, mimefactory.m_out->len) ) {
dc_smtp_disconnect(mailbox->m_smtp);
dc_job_try_again_later(job, DC_AT_ONCE); /* MR_AT_ONCE is only the _initial_ delay, if the second try failes, the delay gets larger */
dc_job_try_again_later(job, DC_AT_ONCE); /* DC_AT_ONCE is only the _initial_ delay, if the second try failes, the delay gets larger */
goto cleanup;
}
@ -637,7 +637,7 @@ static void dc_job_perform(dc_context_t* mailbox, int thread)
// if the job did not succeeded AND this is a smtp-job AND we're online, try over after a mini-delay of one second.
// if we're not online, the ui calls interrupt idle as soon as we're online again.
// if nothing of this happens, after MR_SMTP_IDLE_SEC (60) we try again.
// if nothing of this happens, after DC_SMTP_IDLE_SEC (60) we try again.
if( thread == DC_SMTP_THREAD
&& dc_is_online(mailbox) )
{
@ -876,7 +876,7 @@ void dc_perform_smtp_idle(dc_context_t* context)
do {
int r = 0;
struct timespec timeToWait;
timeToWait.tv_sec = time(NULL) + ((context->m_perform_smtp_jobs_needed==DC_JOBS_NEEDED_AVOID_DOS)? 1 : MR_SMTP_IDLE_SEC);
timeToWait.tv_sec = time(NULL) + ((context->m_perform_smtp_jobs_needed==DC_JOBS_NEEDED_AVOID_DOS)? 1 : DC_SMTP_IDLE_SEC);
timeToWait.tv_nsec = 0;
while (context->m_smtpidle_condflag==0 && r==0) {
r = pthread_cond_timedwait(&context->m_smtpidle_cond, &context->m_smtpidle_condmutex, &timeToWait); // unlock mutex -> wait -> lock mutex

View file

@ -19,8 +19,8 @@
******************************************************************************/
#ifndef __MRJOB_H__
#define __MRJOB_H__
#ifndef __DC_JOB_H__
#define __DC_JOB_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -47,14 +47,14 @@ extern "C" {
// timeouts until actions are aborted.
// this may also affects IDLE to return, so a re-connect may take this time.
// mailcore2 uses 30 seconds, k-9 uses 10 seconds
#define MR_IMAP_TIMEOUT_SEC 10
#define MR_SMTP_TIMEOUT_SEC 10
#define DC_IMAP_TIMEOUT_SEC 10
#define DC_SMTP_TIMEOUT_SEC 10
// this is the timeout after which dc_perform_smtp_idle() returns at latest.
// this timeout should not be too large as this might be the only option to perform
// jobs that failed on the first execution.
#define MR_SMTP_IDLE_SEC 60
#define DC_SMTP_IDLE_SEC 60
/**
@ -89,5 +89,5 @@ void dc_job_do_DC_JOB_CONFIGURE_IMAP (dc_context_t*, dc_job_t*);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRJOB_H__ */
#endif /* __DC_JOB_H__ */

View file

@ -33,7 +33,7 @@
******************************************************************************/
void mr_wipe_secret_mem(void* buf, size_t buf_bytes)
void dc_wipe_secret_mem(void* buf, size_t buf_bytes)
{
/* wipe private keys or othere secrets with zeros so that secrets are no longer in RAM */
if( buf == NULL || buf_bytes <= 0 ) {
@ -51,7 +51,7 @@ static void dc_key_empty(dc_key_t* ths) /* only use before calling setters; take
}
if( ths->m_type==DC_KEY_PRIVATE ) {
mr_wipe_secret_mem(ths->m_binary, ths->m_bytes);
dc_wipe_secret_mem(ths->m_binary, ths->m_bytes);
}
free(ths->m_binary);
@ -317,7 +317,7 @@ static long crc_octets(const unsigned char *octets, size_t len)
}
char* mr_render_base64(const void* buf, size_t buf_bytes, int break_every, const char* break_chars,
char* dc_render_base64(const void* buf, size_t buf_bytes, int break_every, const char* break_chars,
int add_checksum /*0=no checksum, 1=add without break, 2=add with break_chars*/)
{
char* ret = NULL;
@ -374,7 +374,7 @@ char* dc_key_render_base64(const dc_key_t* ths, int break_every, const char* bre
if( ths==NULL ) {
return NULL;
}
return mr_render_base64(ths->m_binary, ths->m_bytes, break_every, break_chars, add_checksum);
return dc_render_base64(ths->m_binary, ths->m_bytes, break_every, break_chars, add_checksum);
}
@ -429,7 +429,7 @@ cleanup:
/* make a fingerprint human-readable */
char* mr_format_fingerprint(const char* fingerprint)
char* dc_format_fingerprint(const char* fingerprint)
{
int i = 0, fingerprint_len = strlen(fingerprint);
dc_strbuilder_t ret;
@ -466,7 +466,7 @@ char* dc_normalize_fingerprint(const char* in)
const char* p1 = in;
while( *p1 ) {
if( (*p1 >= '0' && *p1 <= '9') || (*p1 >= 'A' && *p1 <= 'F') || (*p1 >= 'a' && *p1 <= 'f') ) {
dc_strbuilder_catf(&out, "%c", toupper(*p1)); /* make uppercase which is needed as we do not search case-insensitive, see comment in mrsqlite3.c */
dc_strbuilder_catf(&out, "%c", toupper(*p1)); /* make uppercase which is needed as we do not search case-insensitive, see comment in dc_sqlite3.c */
}
p1++;
}
@ -500,7 +500,7 @@ cleanup:
char* dc_key_get_formatted_fingerprint(const dc_key_t* key)
{
char* rawhex = dc_key_get_fingerprint(key);
char* formatted = mr_format_fingerprint(rawhex);
char* formatted = dc_format_fingerprint(rawhex);
free(rawhex);
return formatted;
}

View file

@ -20,8 +20,8 @@
******************************************************************************/
#ifndef __MRKEY_H__
#define __MRKEY_H__
#ifndef __DC_KEY_H__
#define __DC_KEY_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -48,36 +48,37 @@ typedef struct dc_key_t
} dc_key_t;
dc_key_t* dc_key_new ();
dc_key_t* dc_key_ref (dc_key_t*);
void dc_key_unref (dc_key_t*);
dc_key_t* dc_key_new ();
dc_key_t* dc_key_ref (dc_key_t*);
void dc_key_unref (dc_key_t*);
int dc_key_set_from_binary (dc_key_t*, const void* data, int bytes, int type);
int dc_key_set_from_key (dc_key_t*, const dc_key_t*);
int dc_key_set_from_stmt (dc_key_t*, sqlite3_stmt*, int index, int type);
int dc_key_set_from_base64 (dc_key_t*, const char* base64, int type);
int dc_key_set_from_file (dc_key_t*, const char* file, dc_context_t* mailbox);
int dc_key_set_from_binary (dc_key_t*, const void* data, int bytes, int type);
int dc_key_set_from_key (dc_key_t*, const dc_key_t*);
int dc_key_set_from_stmt (dc_key_t*, sqlite3_stmt*, int index, int type);
int dc_key_set_from_base64 (dc_key_t*, const char* base64, int type);
int dc_key_set_from_file (dc_key_t*, const char* file, dc_context_t* mailbox);
int dc_key_equals (const dc_key_t*, const dc_key_t*);
int dc_key_equals (const dc_key_t*, const dc_key_t*);
int dc_key_save_self_keypair__(const dc_key_t* public_key, const dc_key_t* private_key, const char* addr, int is_default, dc_sqlite3_t* sql);
int dc_key_load_self_public__ (dc_key_t*, const char* self_addr, dc_sqlite3_t* sql);
int dc_key_load_self_private__(dc_key_t*, const char* self_addr, dc_sqlite3_t* sql);
int dc_key_save_self_keypair__ (const dc_key_t* public_key, const dc_key_t* private_key, const char* addr, int is_default, dc_sqlite3_t* sql);
int dc_key_load_self_public__ (dc_key_t*, const char* self_addr, dc_sqlite3_t* sql);
int dc_key_load_self_private__ (dc_key_t*, const char* self_addr, dc_sqlite3_t* sql);
char* mr_render_base64 (const void* buf, size_t buf_bytes, int break_every, const char* break_chars, int add_checksum); /* the result must be freed */
char* dc_key_render_base64(const dc_key_t* ths, int break_every, const char* break_chars, int add_checksum); /* the result must be freed */
char* dc_key_render_asc (const dc_key_t*, const char* add_header_lines); /* each header line must be terminated by \r\n, the result must be freed */
int dc_key_render_asc_to_file(const dc_key_t*, const char* file, dc_context_t* mailbox);
char* dc_render_base64 (const void* buf, size_t buf_bytes, int break_every, const char* break_chars, int add_checksum); /* the result must be freed */
char* dc_key_render_base64 (const dc_key_t* ths, int break_every, const char* break_chars, int add_checksum); /* the result must be freed */
char* dc_key_render_asc (const dc_key_t*, const char* add_header_lines); /* each header line must be terminated by \r\n, the result must be freed */
int dc_key_render_asc_to_file (const dc_key_t*, const char* file, dc_context_t* mailbox);
char* mr_format_fingerprint (const char*);
char* dc_normalize_fingerprint (const char*);
char* dc_key_get_fingerprint (const dc_key_t*);
char* dc_key_get_formatted_fingerprint(const dc_key_t*);
char* dc_format_fingerprint (const char*);
char* dc_normalize_fingerprint (const char*);
char* dc_key_get_fingerprint (const dc_key_t*);
char* dc_key_get_formatted_fingerprint(const dc_key_t*);
void dc_wipe_secret_mem (void* buf, size_t buf_bytes);
void mr_wipe_secret_mem(void* buf, size_t buf_bytes);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRKEY_H__ */
#endif /* __DC_KEY_H__ */

View file

@ -20,8 +20,8 @@
******************************************************************************/
#ifndef __MRKEYRING_H__
#define __MRKEYRING_H__
#ifndef __DC_KEYRING_H__
#define __DC_KEYRING_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -38,20 +38,20 @@ typedef struct dc_keyring_t
/** @privatesection */
dc_key_t** m_keys; /**< Keys in the keyring. Only pointers to keys, the caller is responsible for freeing them and should make sure, the pointers are valid as long as the keyring is valid. */
int m_count;
int m_allocated;
int m_count;
int m_allocated;
} dc_keyring_t;
dc_keyring_t* dc_keyring_new ();
void dc_keyring_unref();
void dc_keyring_unref();
void dc_keyring_add (dc_keyring_t*, dc_key_t*); /* the reference counter of the key is increased by one */
void dc_keyring_add (dc_keyring_t*, dc_key_t*); /* the reference counter of the key is increased by one */
int dc_keyring_load_self_private_for_decrypting__(dc_keyring_t*, const char* self_addr, dc_sqlite3_t* sql);
int dc_keyring_load_self_private_for_decrypting__(dc_keyring_t*, const char* self_addr, dc_sqlite3_t* sql);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRKEYRING_H__ */
#endif /* __DC_KEYRING_H__ */

View file

@ -74,23 +74,23 @@ void dc_loginparam_empty(dc_loginparam_t* ths)
void dc_loginparam_read__(dc_loginparam_t* ths, dc_sqlite3_t* sql, const char* prefix)
{
char* key = NULL;
#define MR_PREFIX(a) sqlite3_free(key); key=sqlite3_mprintf("%s%s", prefix, (a));
#define LP_PREFIX(a) sqlite3_free(key); key=sqlite3_mprintf("%s%s", prefix, (a));
dc_loginparam_empty(ths);
MR_PREFIX("addr"); ths->m_addr = dc_sqlite3_get_config__ (sql, key, NULL);
LP_PREFIX("addr"); ths->m_addr = dc_sqlite3_get_config__ (sql, key, NULL);
MR_PREFIX("mail_server"); ths->m_mail_server = dc_sqlite3_get_config__ (sql, key, NULL);
MR_PREFIX("mail_port"); ths->m_mail_port = dc_sqlite3_get_config_int__(sql, key, 0);
MR_PREFIX("mail_user"); ths->m_mail_user = dc_sqlite3_get_config__ (sql, key, NULL);
MR_PREFIX("mail_pw"); ths->m_mail_pw = dc_sqlite3_get_config__ (sql, key, NULL);
LP_PREFIX("mail_server"); ths->m_mail_server = dc_sqlite3_get_config__ (sql, key, NULL);
LP_PREFIX("mail_port"); ths->m_mail_port = dc_sqlite3_get_config_int__(sql, key, 0);
LP_PREFIX("mail_user"); ths->m_mail_user = dc_sqlite3_get_config__ (sql, key, NULL);
LP_PREFIX("mail_pw"); ths->m_mail_pw = dc_sqlite3_get_config__ (sql, key, NULL);
MR_PREFIX("send_server"); ths->m_send_server = dc_sqlite3_get_config__ (sql, key, NULL);
MR_PREFIX("send_port"); ths->m_send_port = dc_sqlite3_get_config_int__(sql, key, 0);
MR_PREFIX("send_user"); ths->m_send_user = dc_sqlite3_get_config__ (sql, key, NULL);
MR_PREFIX("send_pw"); ths->m_send_pw = dc_sqlite3_get_config__ (sql, key, NULL);
LP_PREFIX("send_server"); ths->m_send_server = dc_sqlite3_get_config__ (sql, key, NULL);
LP_PREFIX("send_port"); ths->m_send_port = dc_sqlite3_get_config_int__(sql, key, 0);
LP_PREFIX("send_user"); ths->m_send_user = dc_sqlite3_get_config__ (sql, key, NULL);
LP_PREFIX("send_pw"); ths->m_send_pw = dc_sqlite3_get_config__ (sql, key, NULL);
MR_PREFIX("server_flags");ths->m_server_flags= dc_sqlite3_get_config_int__(sql, key, 0);
LP_PREFIX("server_flags");ths->m_server_flags= dc_sqlite3_get_config_int__(sql, key, 0);
sqlite3_free(key);
}
@ -100,19 +100,19 @@ void dc_loginparam_write__(const dc_loginparam_t* ths, dc_sqlite3_t* sql, const
{
char* key = NULL;
MR_PREFIX("addr"); dc_sqlite3_set_config__ (sql, key, ths->m_addr);
LP_PREFIX("addr"); dc_sqlite3_set_config__ (sql, key, ths->m_addr);
MR_PREFIX("mail_server"); dc_sqlite3_set_config__ (sql, key, ths->m_mail_server);
MR_PREFIX("mail_port"); dc_sqlite3_set_config_int__(sql, key, ths->m_mail_port);
MR_PREFIX("mail_user"); dc_sqlite3_set_config__ (sql, key, ths->m_mail_user);
MR_PREFIX("mail_pw"); dc_sqlite3_set_config__ (sql, key, ths->m_mail_pw);
LP_PREFIX("mail_server"); dc_sqlite3_set_config__ (sql, key, ths->m_mail_server);
LP_PREFIX("mail_port"); dc_sqlite3_set_config_int__(sql, key, ths->m_mail_port);
LP_PREFIX("mail_user"); dc_sqlite3_set_config__ (sql, key, ths->m_mail_user);
LP_PREFIX("mail_pw"); dc_sqlite3_set_config__ (sql, key, ths->m_mail_pw);
MR_PREFIX("send_server"); dc_sqlite3_set_config__ (sql, key, ths->m_send_server);
MR_PREFIX("send_port"); dc_sqlite3_set_config_int__(sql, key, ths->m_send_port);
MR_PREFIX("send_user"); dc_sqlite3_set_config__ (sql, key, ths->m_send_user);
MR_PREFIX("send_pw"); dc_sqlite3_set_config__ (sql, key, ths->m_send_pw);
LP_PREFIX("send_server"); dc_sqlite3_set_config__ (sql, key, ths->m_send_server);
LP_PREFIX("send_port"); dc_sqlite3_set_config_int__(sql, key, ths->m_send_port);
LP_PREFIX("send_user"); dc_sqlite3_set_config__ (sql, key, ths->m_send_user);
LP_PREFIX("send_pw"); dc_sqlite3_set_config__ (sql, key, ths->m_send_pw);
MR_PREFIX("server_flags"); dc_sqlite3_set_config_int__(sql, key, ths->m_server_flags);
LP_PREFIX("server_flags"); dc_sqlite3_set_config_int__(sql, key, ths->m_server_flags);
sqlite3_free(key);
}
@ -130,19 +130,19 @@ static char* get_readable_flags(int flags)
{
int flag_added = 0;
CAT_FLAG(MR_AUTH_XOAUTH2, "XOAUTH2 ");
CAT_FLAG(MR_AUTH_NORMAL, "AUTH_NORMAL ");
CAT_FLAG(DC_LP_AUTH_XOAUTH2, "XOAUTH2 ");
CAT_FLAG(DC_LP_AUTH_NORMAL, "AUTH_NORMAL ");
CAT_FLAG(MR_IMAP_SOCKET_STARTTLS, "IMAP_STARTTLS ");
CAT_FLAG(MR_IMAP_SOCKET_SSL, "IMAP_SSL ");
CAT_FLAG(MR_IMAP_SOCKET_PLAIN, "IMAP_PLAIN ");
CAT_FLAG(DC_LP_IMAP_SOCKET_STARTTLS, "IMAP_STARTTLS ");
CAT_FLAG(DC_LP_IMAP_SOCKET_SSL, "IMAP_SSL ");
CAT_FLAG(DC_LP_IMAP_SOCKET_PLAIN, "IMAP_PLAIN ");
CAT_FLAG(MR_SMTP_SOCKET_STARTTLS, "SMTP_STARTTLS ");
CAT_FLAG(MR_SMTP_SOCKET_SSL, "SMTP_SSL ");
CAT_FLAG(MR_SMTP_SOCKET_PLAIN, "SMTP_PLAIN ");
CAT_FLAG(DC_LP_SMTP_SOCKET_STARTTLS, "SMTP_STARTTLS ");
CAT_FLAG(DC_LP_SMTP_SOCKET_SSL, "SMTP_SSL ");
CAT_FLAG(DC_LP_SMTP_SOCKET_PLAIN, "SMTP_PLAIN ");
CAT_FLAG(MR_NO_EXTRA_IMAP_UPLOAD, "NO_EXTRA_IMAP_UPLOAD ");
CAT_FLAG(MR_NO_MOVE_TO_CHATS, "NO_MOVE_TO_CHATS ");
CAT_FLAG(DC_NO_EXTRA_IMAP_UPLOAD, "NO_EXTRA_IMAP_UPLOAD ");
CAT_FLAG(DC_NO_MOVE_TO_CHATS, "NO_MOVE_TO_CHATS ");
if( !flag_added ) {
char* temp = dc_mprintf("0x%x ", 1<<bit); dc_strbuilder_cat(&strbuilder, temp); free(temp);

View file

@ -20,8 +20,8 @@
******************************************************************************/
#ifndef __MRLOGINPARAM_H__
#define __MRLOGINPARAM_H__
#ifndef __DC_LOGINPARAM_H__
#define __DC_LOGINPARAM_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -48,22 +48,22 @@ typedef struct dc_loginparam_t
int m_send_port;
/* Server options*/
#define MR_AUTH_XOAUTH2 0x2
#define MR_AUTH_NORMAL 0x4
#define MR_AUTH_FLAGS (MR_AUTH_XOAUTH2|MR_AUTH_NORMAL) /* if none of these flags are set, the default is choosen, even if MR_NO_AUTOCONFIG is set */
#define DC_LP_AUTH_XOAUTH2 0x2
#define DC_LP_AUTH_NORMAL 0x4
#define DC_LP_AUTH_FLAGS (DC_LP_AUTH_XOAUTH2|DC_LP_AUTH_NORMAL) /* if none of these flags are set, the default is choosen */
#define MR_IMAP_SOCKET_STARTTLS 0x100
#define MR_IMAP_SOCKET_SSL 0x200
#define MR_IMAP_SOCKET_PLAIN 0x400
#define MR_IMAP_SOCKET_FLAGS (MR_IMAP_SOCKET_STARTTLS|MR_IMAP_SOCKET_SSL|MR_IMAP_SOCKET_PLAIN) /* if none of these flags are set, the default is choosen, even if MR_NO_AUTOCONFIG is set */
#define DC_LP_IMAP_SOCKET_STARTTLS 0x100
#define DC_LP_IMAP_SOCKET_SSL 0x200
#define DC_LP_IMAP_SOCKET_PLAIN 0x400
#define DC_LP_IMAP_SOCKET_FLAGS (DC_LP_IMAP_SOCKET_STARTTLS|DC_LP_IMAP_SOCKET_SSL|DC_LP_IMAP_SOCKET_PLAIN) /* if none of these flags are set, the default is choosen */
#define MR_SMTP_SOCKET_STARTTLS 0x10000
#define MR_SMTP_SOCKET_SSL 0x20000
#define MR_SMTP_SOCKET_PLAIN 0x40000
#define MR_SMTP_SOCKET_FLAGS (MR_SMTP_SOCKET_STARTTLS|MR_SMTP_SOCKET_SSL|MR_SMTP_SOCKET_PLAIN) /* if none of these flags are set, the default is choosen, even if MR_NO_AUTOCONFIG is set */
#define DC_LP_SMTP_SOCKET_STARTTLS 0x10000
#define DC_LP_SMTP_SOCKET_SSL 0x20000
#define DC_LP_SMTP_SOCKET_PLAIN 0x40000
#define DC_LP_SMTP_SOCKET_FLAGS (DC_LP_SMTP_SOCKET_STARTTLS|DC_LP_SMTP_SOCKET_SSL|DC_LP_SMTP_SOCKET_PLAIN) /* if none of these flags are set, the default is choosen */
#define MR_NO_EXTRA_IMAP_UPLOAD 0x2000000
#define MR_NO_MOVE_TO_CHATS 0x4000000
#define DC_NO_EXTRA_IMAP_UPLOAD 0x2000000
#define DC_NO_MOVE_TO_CHATS 0x4000000
int m_server_flags;
} dc_loginparam_t;
@ -80,5 +80,5 @@ char* dc_loginparam_get_readable (const dc_loginparam_t*);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRLOGINPARAM_H__ */
#endif /* __DC_LOGINPARAM_H__ */

View file

@ -23,7 +23,7 @@
#include "dc_context.h"
#define MR_LOT_MAGIC 0x00107107
#define DC_LOT_MAGIC 0x00107107
dc_lot_t* dc_lot_new()
@ -34,7 +34,7 @@ dc_lot_t* dc_lot_new()
exit(27); /* cannot allocate little memory, unrecoverable error */
}
ths->m_magic = MR_LOT_MAGIC;
ths->m_magic = DC_LOT_MAGIC;
ths->m_text1_meaning = 0;
return ths;
@ -55,7 +55,7 @@ dc_lot_t* dc_lot_new()
*/
void dc_lot_unref(dc_lot_t* set)
{
if( set==NULL || set->m_magic != MR_LOT_MAGIC ) {
if( set==NULL || set->m_magic != DC_LOT_MAGIC ) {
return;
}
@ -67,7 +67,7 @@ void dc_lot_unref(dc_lot_t* set)
void dc_lot_empty(dc_lot_t* ths)
{
if( ths == NULL || ths->m_magic != MR_LOT_MAGIC ) {
if( ths == NULL || ths->m_magic != DC_LOT_MAGIC ) {
return;
}
@ -104,7 +104,7 @@ void dc_lot_empty(dc_lot_t* ths)
*/
char* dc_lot_get_text1(dc_lot_t* lot)
{
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
if( lot == NULL || lot->m_magic != DC_LOT_MAGIC ) {
return NULL;
}
return dc_strdup_keep_null(lot->m_text1);
@ -122,7 +122,7 @@ char* dc_lot_get_text1(dc_lot_t* lot)
*/
char* dc_lot_get_text2(dc_lot_t* lot)
{
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
if( lot == NULL || lot->m_magic != DC_LOT_MAGIC ) {
return NULL;
}
return dc_strdup_keep_null(lot->m_text2);
@ -142,7 +142,7 @@ char* dc_lot_get_text2(dc_lot_t* lot)
*/
int dc_lot_get_text1_meaning(dc_lot_t* lot)
{
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
if( lot == NULL || lot->m_magic != DC_LOT_MAGIC ) {
return 0;
}
return lot->m_text1_meaning;
@ -160,7 +160,7 @@ int dc_lot_get_text1_meaning(dc_lot_t* lot)
*/
int dc_lot_get_state(dc_lot_t* lot)
{
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
if( lot == NULL || lot->m_magic != DC_LOT_MAGIC ) {
return 0;
}
return lot->m_state;
@ -178,7 +178,7 @@ int dc_lot_get_state(dc_lot_t* lot)
*/
uint32_t dc_lot_get_id(dc_lot_t* lot)
{
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
if( lot == NULL || lot->m_magic != DC_LOT_MAGIC ) {
return 0;
}
return lot->m_id;
@ -196,7 +196,7 @@ uint32_t dc_lot_get_id(dc_lot_t* lot)
*/
time_t dc_lot_get_timestamp(dc_lot_t* lot)
{
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
if( lot == NULL || lot->m_magic != DC_LOT_MAGIC ) {
return 0;
}
return lot->m_timestamp;
@ -205,7 +205,7 @@ time_t dc_lot_get_timestamp(dc_lot_t* lot)
void dc_lot_fill(dc_lot_t* ths, const dc_msg_t* msg, const dc_chat_t* chat, const dc_contact_t* contact)
{
if( ths == NULL || ths->m_magic != MR_LOT_MAGIC || msg == NULL ) {
if( ths == NULL || ths->m_magic != DC_LOT_MAGIC || msg == NULL ) {
return;
}
@ -217,7 +217,7 @@ void dc_lot_fill(dc_lot_t* ths, const dc_msg_t* msg, const dc_chat_t* chat, cons
}
else {
ths->m_text1 = dc_stock_str(DC_STR_SELF);
ths->m_text1_meaning = MR_TEXT1_SELF;
ths->m_text1_meaning = DC_TEXT1_SELF;
}
}
else if( chat == NULL )
@ -233,11 +233,11 @@ void dc_lot_fill(dc_lot_t* ths, const dc_msg_t* msg, const dc_chat_t* chat, cons
}
else {
ths->m_text1 = dc_contact_get_first_name(contact);
ths->m_text1_meaning = MR_TEXT1_USERNAME;
ths->m_text1_meaning = DC_TEXT1_USERNAME;
}
}
ths->m_text2 = dc_msg_get_summarytext_by_raw(msg->m_type, msg->m_text, msg->m_param, MR_SUMMARY_CHARACTERS);
ths->m_text2 = dc_msg_get_summarytext_by_raw(msg->m_type, msg->m_text, msg->m_param, DC_SUMMARY_CHARACTERS);
ths->m_timestamp = dc_msg_get_timestamp(msg);
ths->m_state = msg->m_state;
}

View file

@ -20,14 +20,14 @@
******************************************************************************/
#ifndef __MRLOT_PRIVATE_H__
#define __MRLOT_PRIVATE_H__
#ifndef __DC_LOT_H__
#define __DC_LOT_H__
#ifdef __cplusplus
extern "C" {
#endif
/** Structure behind dclot_t */
/** Structure behind dc_lot_t */
struct _dc_lot
{
/** @privatesection */
@ -47,11 +47,11 @@ struct _dc_lot
/* library-internal */
#define MR_SUMMARY_CHARACTERS 160 /* in practice, the user additionally cuts the string himself pixel-accurate */
#define DC_SUMMARY_CHARACTERS 160 /* in practice, the user additionally cuts the string himself pixel-accurate */
void dc_lot_fill (dc_lot_t*, const dc_msg_t*, const dc_chat_t*, const dc_contact_t*);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRLOT_PRIVATE_H__ */
#endif /* __DC_LOT_H__ */

View file

@ -766,7 +766,7 @@ int dc_mimefactory_render(dc_mimefactory_t* factory)
- in older versions, we did not encrypt messages to ourself when they to to SMTP - however, if these messages
are forwarded for any reasons (eg. gmail always forwards to IMAP), we have no chance to decrypt them;
this issue is fixed with 0.9.4 */
force_plaintext = MRFP_NO_AUTOCRYPT_HEADER;
force_plaintext = DC_FP_NO_AUTOCRYPT_HEADER;
}
else
{
@ -787,7 +787,7 @@ int dc_mimefactory_render(dc_mimefactory_t* factory)
struct mailimf_subject* subject = mailimf_subject_new(dc_encode_header_words(subject_str));
mailimf_fields_add(imf_fields, mailimf_field_new(MAILIMF_FIELD_SUBJECT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, subject, NULL, NULL, NULL));
if( force_plaintext != MRFP_NO_AUTOCRYPT_HEADER ) {
if( force_plaintext != DC_FP_NO_AUTOCRYPT_HEADER ) {
dc_e2ee_encrypt(factory->m_context, factory->m_recipients_addr, force_plaintext, e2ee_guaranteed, min_verified, message, &e2ee_helper);
}

View file

@ -33,9 +33,9 @@
******************************************************************************/
#ifdef MR_USE_MIME_DEBUG
#ifdef DC_USE_MIME_DEBUG
/* if you need this functionality, define MR_USE_MIME_DEBUG in the project,
/* if you need this functionality, define DC_USE_MIME_DEBUG in the project,
eg. in Codeblocks at "Project / Build options / <project or target> / Compiler settings / #defines" */
@ -661,20 +661,20 @@ static int mailmime_is_attachment_disposition(struct mailmime* mime)
static int mailmime_get_mime_type(struct mailmime* mime, int* msg_type)
{
#define MR_MIMETYPE_MP_ALTERNATIVE 10
#define MR_MIMETYPE_MP_RELATED 20
#define MR_MIMETYPE_MP_MIXED 30
#define MR_MIMETYPE_MP_NOT_DECRYPTABLE 40
#define MR_MIMETYPE_MP_REPORT 45
#define MR_MIMETYPE_MP_SIGNED 46
#define MR_MIMETYPE_MP_OTHER 50
#define MR_MIMETYPE_TEXT_PLAIN 60
#define MR_MIMETYPE_TEXT_HTML 70
#define MR_MIMETYPE_IMAGE 80
#define MR_MIMETYPE_AUDIO 90
#define MR_MIMETYPE_VIDEO 100
#define MR_MIMETYPE_FILE 110
#define MR_MIMETYPE_AC_SETUP_FILE 111
#define DC_MIMETYPE_MP_ALTERNATIVE 10
#define DC_MIMETYPE_MP_RELATED 20
#define DC_MIMETYPE_MP_MIXED 30
#define DC_MIMETYPE_MP_NOT_DECRYPTABLE 40
#define DC_MIMETYPE_MP_REPORT 45
#define DC_MIMETYPE_MP_SIGNED 46
#define DC_MIMETYPE_MP_OTHER 50
#define DC_MIMETYPE_TEXT_PLAIN 60
#define DC_MIMETYPE_TEXT_HTML 70
#define DC_MIMETYPE_IMAGE 80
#define DC_MIMETYPE_AUDIO 90
#define DC_MIMETYPE_VIDEO 100
#define DC_MIMETYPE_FILE 110
#define DC_MIMETYPE_AC_SETUP_FILE 111
struct mailmime_content* c = mime->mm_content_type;
int dummy; if( msg_type == NULL ) { msg_type = &dummy; }
@ -691,18 +691,18 @@ static int mailmime_get_mime_type(struct mailmime* mime, int* msg_type)
{
case MAILMIME_DISCRETE_TYPE_TEXT:
if( mailmime_is_attachment_disposition(mime) ) {
; /* MR_MIMETYPE_FILE is returned below - we leave text attachments as attachments as they may be too large to display as a normal message, eg. complete books. */
; /* DC_MIMETYPE_FILE is returned below - we leave text attachments as attachments as they may be too large to display as a normal message, eg. complete books. */
}
else if( strcmp(c->ct_subtype, "plain")==0 ) {
*msg_type = DC_MSG_TEXT;
return MR_MIMETYPE_TEXT_PLAIN;
return DC_MIMETYPE_TEXT_PLAIN;
}
else if( strcmp(c->ct_subtype, "html")==0 ) {
*msg_type = DC_MSG_TEXT;
return MR_MIMETYPE_TEXT_HTML;
return DC_MIMETYPE_TEXT_HTML;
}
*msg_type = DC_MSG_FILE;
return MR_MIMETYPE_FILE;
return DC_MIMETYPE_FILE;
case MAILMIME_DISCRETE_TYPE_IMAGE:
if( strcmp(c->ct_subtype, "gif")==0 ) {
@ -710,28 +710,28 @@ static int mailmime_get_mime_type(struct mailmime* mime, int* msg_type)
}
else if( strcmp(c->ct_subtype, "svg+xml")==0 ) {
*msg_type = DC_MSG_FILE;
return MR_MIMETYPE_FILE;
return DC_MIMETYPE_FILE;
}
else {
*msg_type = DC_MSG_IMAGE;
}
return MR_MIMETYPE_IMAGE;
return DC_MIMETYPE_IMAGE;
case MAILMIME_DISCRETE_TYPE_AUDIO:
*msg_type = DC_MSG_AUDIO; /* we correct this later to DC_MSG_VOICE, currently, this is not possible as we do not know the main header */
return MR_MIMETYPE_AUDIO;
return DC_MIMETYPE_AUDIO;
case MAILMIME_DISCRETE_TYPE_VIDEO:
*msg_type = DC_MSG_VIDEO;
return MR_MIMETYPE_VIDEO;
return DC_MIMETYPE_VIDEO;
default:
*msg_type = DC_MSG_FILE;
if( c->ct_type->tp_data.tp_discrete_type->dt_type == MAILMIME_DISCRETE_TYPE_APPLICATION
&& strcmp(c->ct_subtype, "autocrypt-setup")==0 ) {
return MR_MIMETYPE_AC_SETUP_FILE; /* application/autocrypt-setup */
return DC_MIMETYPE_AC_SETUP_FILE; /* application/autocrypt-setup */
}
return MR_MIMETYPE_FILE;
return DC_MIMETYPE_FILE;
}
break;
@ -739,25 +739,25 @@ static int mailmime_get_mime_type(struct mailmime* mime, int* msg_type)
if( c->ct_type->tp_data.tp_composite_type->ct_type == MAILMIME_COMPOSITE_TYPE_MULTIPART )
{
if( strcmp(c->ct_subtype, "alternative")==0 ) {
return MR_MIMETYPE_MP_ALTERNATIVE;
return DC_MIMETYPE_MP_ALTERNATIVE;
}
else if( strcmp(c->ct_subtype, "related")==0 ) {
return MR_MIMETYPE_MP_RELATED;
return DC_MIMETYPE_MP_RELATED;
}
else if( strcmp(c->ct_subtype, "encrypted")==0 ) {
return MR_MIMETYPE_MP_NOT_DECRYPTABLE; /* decryptable parts are already converted to other mime parts in mre2ee_decrypt() */
return DC_MIMETYPE_MP_NOT_DECRYPTABLE; /* decryptable parts are already converted to other mime parts in dc_e2ee_decrypt() */
}
else if( strcmp(c->ct_subtype, "signed")==0 ) {
return MR_MIMETYPE_MP_SIGNED;
return DC_MIMETYPE_MP_SIGNED;
}
else if( strcmp(c->ct_subtype, "mixed")==0 ) {
return MR_MIMETYPE_MP_MIXED;
return DC_MIMETYPE_MP_MIXED;
}
else if( strcmp(c->ct_subtype, "report")==0 ) {
return MR_MIMETYPE_MP_REPORT;
return DC_MIMETYPE_MP_REPORT;
}
else {
return MR_MIMETYPE_MP_OTHER;
return DC_MIMETYPE_MP_OTHER;
}
}
else if( c->ct_type->tp_data.tp_composite_type->ct_type == MAILMIME_COMPOSITE_TYPE_MESSAGE )
@ -766,7 +766,7 @@ static int mailmime_get_mime_type(struct mailmime* mime, int* msg_type)
Also used as part "message/disposition-notification" of "multipart/report", which, however, will be handled separatedly.
I've not seen any messages using this, so we do not attach these parts (maybe they're used to attach replies, which are unwanted at all).
For now, we skip these parts at all; if desired, we could return MR_MIMETYPE_FILE/DC_MSG_FILE for selected and known subparts. */
For now, we skip these parts at all; if desired, we could return DC_MIMETYPE_FILE/DC_MSG_FILE for selected and known subparts. */
return 0;
}
break;
@ -784,7 +784,7 @@ static int mailmime_get_mime_type(struct mailmime* mime, int* msg_type)
******************************************************************************/
static dc_mimepart_t* mrmimepart_new(void)
static dc_mimepart_t* dc_mimepart_new(void)
{
dc_mimepart_t* ths = NULL;
@ -799,7 +799,7 @@ static dc_mimepart_t* mrmimepart_new(void)
}
static void mrmimepart_unref(dc_mimepart_t* ths)
static void dc_mimepart_unref(dc_mimepart_t* ths)
{
if( ths == NULL ) {
return;
@ -904,7 +904,7 @@ void dc_mimeparser_empty(dc_mimeparser_t* ths)
for( i = 0; i < cnt; i++ ) {
dc_mimepart_t* part = (dc_mimepart_t*)carray_get(ths->m_parts, i);
if( part ) {
mrmimepart_unref(part);
dc_mimepart_unref(part);
}
}
carray_set_size(ths->m_parts, 0);
@ -949,7 +949,7 @@ static void do_add_single_part(dc_mimeparser_t* parser, dc_mimepart_t* part)
dc_param_set_int(part->m_param, DC_PARAM_GUARANTEE_E2EE, 1);
}
else if( parser->m_e2ee_helper->m_encrypted ) {
dc_param_set_int(part->m_param, DC_PARAM_ERRONEOUS_E2EE, MRE2EE_NO_VALID_SIGNATURE);
dc_param_set_int(part->m_param, DC_PARAM_ERRONEOUS_E2EE, DC_E2EE_NO_VALID_SIGNATURE);
}
carray_add(parser->m_parts, (void*)part, NULL);
}
@ -972,7 +972,7 @@ static void do_add_single_file_part(dc_mimeparser_t* parser, int msg_type, int m
goto cleanup;
}
part = mrmimepart_new();
part = dc_mimepart_new();
part->m_type = msg_type;
part->m_int_mimetype = mime_type;
part->m_bytes = decoded_data_bytes;
@ -984,7 +984,7 @@ static void do_add_single_file_part(dc_mimeparser_t* parser, int msg_type, int m
part->m_msg = dc_get_filesuffix_lc(pathNfilename);
}
if( mime_type == MR_MIMETYPE_IMAGE ) {
if( mime_type == DC_MIMETYPE_IMAGE ) {
uint32_t w = 0, h = 0;
if( dc_get_filemeta(decoded_data, decoded_data_bytes, &w, &h) ) {
dc_param_set_int(part->m_param, DC_PARAM_WIDTH, w);
@ -1007,7 +1007,7 @@ static void do_add_single_file_part(dc_mimeparser_t* parser, int msg_type, int m
cleanup:
free(pathNfilename);
mrmimepart_unref(part);
dc_mimepart_unref(part);
}
@ -1050,8 +1050,8 @@ static int dc_mimeparser_add_single_part_if_known(dc_mimeparser_t* ths, struct m
switch( mime_type )
{
case MR_MIMETYPE_TEXT_PLAIN:
case MR_MIMETYPE_TEXT_HTML:
case DC_MIMETYPE_TEXT_PLAIN:
case DC_MIMETYPE_TEXT_HTML:
{
if( simplifier==NULL ) {
simplifier = dc_simplify_new();
@ -1083,7 +1083,7 @@ static int dc_mimeparser_add_single_part_if_known(dc_mimeparser_t* ths, struct m
char* uu_blob = NULL, *uu_filename = NULL, *new_txt = NULL;
size_t uu_blob_bytes = 0;
int uu_msg_type = 0, added_uu_parts = 0;
while( (new_txt=mruudecode_do(txt, &uu_blob, &uu_blob_bytes, &uu_filename)) != NULL )
while( (new_txt=dc_uudecode_do(txt, &uu_blob, &uu_blob_bytes, &uu_filename)) != NULL )
{
dc_msg_guess_msgtype_from_suffix(uu_filename, &uu_msg_type, NULL);
if( uu_msg_type == 0 ) {
@ -1104,12 +1104,12 @@ static int dc_mimeparser_add_single_part_if_known(dc_mimeparser_t* ths, struct m
}
// add text as DC_MSG_TEXT part
char* simplified_txt = dc_simplify_simplify(simplifier, txt, strlen(txt), mime_type==MR_MIMETYPE_TEXT_HTML? 1 : 0);
char* simplified_txt = dc_simplify_simplify(simplifier, txt, strlen(txt), mime_type==DC_MIMETYPE_TEXT_HTML? 1 : 0);
free(txt);
txt = NULL;
if( simplified_txt && simplified_txt[0] )
{
part = mrmimepart_new();
part = dc_mimepart_new();
part->m_type = DC_MSG_TEXT;
part->m_int_mimetype = mime_type;
part->m_msg = simplified_txt;
@ -1128,11 +1128,11 @@ static int dc_mimeparser_add_single_part_if_known(dc_mimeparser_t* ths, struct m
}
break;
case MR_MIMETYPE_IMAGE:
case MR_MIMETYPE_AUDIO:
case MR_MIMETYPE_VIDEO:
case MR_MIMETYPE_FILE:
case MR_MIMETYPE_AC_SETUP_FILE:
case DC_MIMETYPE_IMAGE:
case DC_MIMETYPE_AUDIO:
case DC_MIMETYPE_VIDEO:
case DC_MIMETYPE_FILE:
case DC_MIMETYPE_AC_SETUP_FILE:
{
/* try to get file name from
`Content-Disposition: ... filename*=...`
@ -1213,7 +1213,7 @@ cleanup:
if( transfer_decoding_buffer ) { mmap_string_unref(transfer_decoding_buffer); }
free(file_suffix);
free(desired_filename);
mrmimepart_unref(part);
dc_mimepart_unref(part);
return carray_count(ths->m_parts)>old_part_count? 1 : 0; /* any part added? */
}
@ -1260,12 +1260,12 @@ static int dc_mimeparser_parse_mime_recursive(dc_mimeparser_t* ths, struct mailm
case MAILMIME_MULTIPLE:
switch( mailmime_get_mime_type(mime, NULL) )
{
case MR_MIMETYPE_MP_ALTERNATIVE: /* add "best" part */
case DC_MIMETYPE_MP_ALTERNATIVE: /* add "best" part */
/* Most times, mutlipart/alternative contains true alternatives as text/plain and text/html.
If we find a multipart/mixed inside mutlipart/alternative, we use this (happens eg in apple mail: "plaintext" as an alternative to "html+PDF attachment") */
for( cur=clist_begin(mime->mm_data.mm_multipart.mm_mp_list); cur!=NULL; cur=clist_next(cur)) {
struct mailmime* childmime = (struct mailmime*)clist_content(cur);
if( mailmime_get_mime_type(childmime, NULL) == MR_MIMETYPE_MP_MIXED ) {
if( mailmime_get_mime_type(childmime, NULL) == DC_MIMETYPE_MP_MIXED ) {
any_part_added = dc_mimeparser_parse_mime_recursive(ths, childmime);
break;
}
@ -1276,7 +1276,7 @@ static int dc_mimeparser_parse_mime_recursive(dc_mimeparser_t* ths, struct mailm
/* search for text/plain and add this */
for( cur=clist_begin(mime->mm_data.mm_multipart.mm_mp_list); cur!=NULL; cur=clist_next(cur)) {
struct mailmime* childmime = (struct mailmime*)clist_content(cur);
if( mailmime_get_mime_type(childmime, NULL) == MR_MIMETYPE_TEXT_PLAIN ) {
if( mailmime_get_mime_type(childmime, NULL) == DC_MIMETYPE_TEXT_PLAIN ) {
any_part_added = dc_mimeparser_parse_mime_recursive(ths, childmime);
break;
}
@ -1293,7 +1293,7 @@ static int dc_mimeparser_parse_mime_recursive(dc_mimeparser_t* ths, struct mailm
}
break;
case MR_MIMETYPE_MP_RELATED: /* add the "root part" - the other parts may be referenced which is not interesting for us (eg. embedded images) */
case DC_MIMETYPE_MP_RELATED: /* add the "root part" - the other parts may be referenced which is not interesting for us (eg. embedded images) */
/* we assume he "root part" being the first one, which may not be always true ... however, most times it seems okay. */
cur=clist_begin(mime->mm_data.mm_multipart.mm_mp_list);
if( cur ) {
@ -1301,9 +1301,9 @@ static int dc_mimeparser_parse_mime_recursive(dc_mimeparser_t* ths, struct mailm
}
break;
case MR_MIMETYPE_MP_NOT_DECRYPTABLE:
case DC_MIMETYPE_MP_NOT_DECRYPTABLE:
{
dc_mimepart_t* part = mrmimepart_new();
dc_mimepart_t* part = dc_mimepart_new();
part->m_type = DC_MSG_TEXT;
char* msg_body = dc_stock_str(DC_STR_CANTDECRYPT_MSG_BODY);
@ -1316,7 +1316,7 @@ static int dc_mimeparser_parse_mime_recursive(dc_mimeparser_t* ths, struct mailm
}
break;
case MR_MIMETYPE_MP_SIGNED:
case DC_MIMETYPE_MP_SIGNED:
/* RFC 1847: "The multipart/signed content type contains exactly two body parts.
The first body part is the body part over which the digital signature was created [...]
The second body part contains the control information necessary to verify the digital signature."
@ -1328,7 +1328,7 @@ static int dc_mimeparser_parse_mime_recursive(dc_mimeparser_t* ths, struct mailm
}
break;
case MR_MIMETYPE_MP_REPORT:
case DC_MIMETYPE_MP_REPORT:
if( clist_count(mime->mm_data.mm_multipart.mm_mp_list) >= 2 ) /* RFC 6522: the first part is for humans, the second for machines */
{
struct mailmime_parameter* report_type = mailmime_find_ct_parameter(mime, "report-type");
@ -1345,7 +1345,7 @@ static int dc_mimeparser_parse_mime_recursive(dc_mimeparser_t* ths, struct mailm
}
break;
default: /* eg. MR_MIME_MP_MIXED - add all parts (in fact, AddSinglePartIfKnown() later check if the parts are really supported) */
default: /* eg. DC_MIMETYPE_MP_MIXED - add all parts (in fact, AddSinglePartIfKnown() later check if the parts are really supported) */
{
/* HACK: the following lines are a hack for clients who use multipart/mixed instead of multipart/alternative for
combined text/html messages (eg. Stock Android "Mail" does so). So, if I detect such a message below, I skip the HTML part.
@ -1356,10 +1356,10 @@ static int dc_mimeparser_parse_mime_recursive(dc_mimeparser_t* ths, struct mailm
int plain_cnt = 0, html_cnt = 0;
for( cur=clist_begin(mime->mm_data.mm_multipart.mm_mp_list); cur!=NULL; cur=clist_next(cur)) {
struct mailmime* childmime = (struct mailmime*)clist_content(cur);
if( mailmime_get_mime_type(childmime, NULL) == MR_MIMETYPE_TEXT_PLAIN ) {
if( mailmime_get_mime_type(childmime, NULL) == DC_MIMETYPE_TEXT_PLAIN ) {
plain_cnt++;
}
else if( mailmime_get_mime_type(childmime, NULL) == MR_MIMETYPE_TEXT_HTML ) {
else if( mailmime_get_mime_type(childmime, NULL) == DC_MIMETYPE_TEXT_HTML ) {
html_part = childmime;
html_cnt++;
}
@ -1527,7 +1527,7 @@ void dc_mimeparser_parse(dc_mimeparser_t* ths, const char* body_not_terminated,
int i, has_setup_file = 0;
for( i = 0; i < carray_count(ths->m_parts); i++ ) {
dc_mimepart_t* part = (dc_mimepart_t*)carray_get(ths->m_parts, i);
if( part->m_int_mimetype==MR_MIMETYPE_AC_SETUP_FILE ) {
if( part->m_int_mimetype==DC_MIMETYPE_AC_SETUP_FILE ) {
has_setup_file = 1;
}
}
@ -1536,8 +1536,8 @@ void dc_mimeparser_parse(dc_mimeparser_t* ths, const char* body_not_terminated,
ths->m_is_system_message = DC_CMD_AUTOCRYPT_SETUP_MESSAGE;
for( i = 0; i < carray_count(ths->m_parts); i++ ) {
dc_mimepart_t* part = (dc_mimepart_t*)carray_get(ths->m_parts, i);
if( part->m_int_mimetype!=MR_MIMETYPE_AC_SETUP_FILE ) {
mrmimepart_unref(part);
if( part->m_int_mimetype!=DC_MIMETYPE_AC_SETUP_FILE ) {
dc_mimepart_unref(part);
carray_delete_slow(ths->m_parts, i);
i--; /* start over with the same index */
}
@ -1574,8 +1574,8 @@ void dc_mimeparser_parse(dc_mimeparser_t* ths, const char* body_not_terminated,
for( i = 0; i < icnt; i++ ) {
dc_mimepart_t* part = (dc_mimepart_t*)carray_get(ths->m_parts, i);
if( part->m_type == DC_MSG_TEXT ) {
#define MR_NDASH "\xE2\x80\x93"
char* new_txt = dc_mprintf("%s " MR_NDASH " %s", subj, part->m_msg);
#define DC_NDASH "\xE2\x80\x93"
char* new_txt = dc_mprintf("%s " DC_NDASH " %s", subj, part->m_msg);
free(part->m_msg);
part->m_msg = new_txt;
break;
@ -1678,7 +1678,7 @@ void dc_mimeparser_parse(dc_mimeparser_t* ths, const char* body_not_terminated,
/* Cleanup - and try to create at least an empty part if there are no parts yet */
cleanup:
if( !dc_mimeparser_has_nonmeta(ths) && carray_count(ths->m_reports)==0 ) {
dc_mimepart_t* part = mrmimepart_new();
dc_mimepart_t* part = dc_mimepart_new();
part->m_type = DC_MSG_TEXT;
part->m_msg = dc_strdup(ths->m_subject? ths->m_subject : "Empty message");
carray_add(ths->m_parts, (void*)part, NULL);

View file

@ -25,8 +25,8 @@ dc_mimeparser_t has no deep dependencies to dc_context_t or to the database
(dc_context_t is used for logging only). */
#ifndef __MRMIMEPARSER_H__
#define __MRMIMEPARSER_H__
#ifndef __DC_MIMEPARSER_H__
#define __DC_MIMEPARSER_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -104,7 +104,7 @@ int dc_mimeparser_sender_equals_recipient(dc_mimepars
/* low-level-tools for working with mailmime structures directly */
#ifdef MR_USE_MIME_DEBUG
#ifdef DC_USE_MIME_DEBUG
void mailmime_print (struct mailmime*);
#endif
struct mailmime_parameter* mailmime_find_ct_parameter (struct mailmime*, const char* name);
@ -119,5 +119,5 @@ dc_hash_t* mailimf_get_recipients (struct mailimf_fi
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRMIMEPARSER_H__ */
#endif /* __DC_MIMEPARSER_H__ */

View file

@ -50,7 +50,7 @@ dc_msg_t* dc_msg_new()
ths->m_magic = DC_MSG_MAGIC;
ths->m_type = DC_MSG_UNDEFINED;
ths->m_state = MR_STATE_UNDEFINED;
ths->m_state = DC_STATE_UNDEFINED;
ths->m_param = dc_param_new();
return ths;
@ -232,7 +232,7 @@ int dc_msg_get_type(const dc_msg_t* msg)
int dc_msg_get_state(const dc_msg_t* msg)
{
if( msg == NULL || msg->m_magic != DC_MSG_MAGIC ) {
return MR_STATE_UNDEFINED;
return DC_STATE_UNDEFINED;
}
return msg->m_state;
}
@ -290,7 +290,7 @@ char* dc_msg_get_text(const dc_msg_t* msg)
}
ret = dc_strdup(msg->m_text);
dc_truncate_str(ret, MR_MAX_GET_TEXT_LEN); /* we do not do this on load: (1) for speed reasons (2) we may decide to process the full text on other places */
dc_truncate_str(ret, DC_MAX_GET_TEXT_LEN); /* we do not do this on load: (1) for speed reasons (2) we may decide to process the full text on other places */
return ret;
}

View file

@ -52,7 +52,7 @@ typedef struct dc_param_t
#define DC_PARAM_TRACKNAME 'n' /* for msgs: name of author or artist */
#define DC_PARAM_GUARANTEE_E2EE 'c' /* for msgs: incoming: message is encryoted, outgoing: guarantee E2EE or the message is not send */
#define DC_PARAM_ERRONEOUS_E2EE 'e' /* for msgs: decrypted with validation errors or without mutual set, if neither 'c' nor 'e' are preset, the messages is only transport encrypted */
#define DC_PARAM_FORCE_PLAINTEXT 'u' /* for msgs: force unencrypted message, either MRFP_ADD_AUTOCRYPT_HEADER (1), MRFP_NO_AUTOCRYPT_HEADER (2) or 0 */
#define DC_PARAM_FORCE_PLAINTEXT 'u' /* for msgs: force unencrypted message, either DC_FP_ADD_AUTOCRYPT_HEADER (1), DC_FP_NO_AUTOCRYPT_HEADER (2) or 0 */
#define DC_PARAM_WANTS_MDN 'r' /* for msgs: an incoming message which requestes a MDN (aka read receipt) */
#define DC_PARAM_FORWARDED 'a' /* for msgs */
#define DC_PARAM_CMD 'S' /* for msgs */
@ -72,8 +72,8 @@ typedef struct dc_param_t
// values for DC_PARAM_FORCE_PLAINTEXT
#define MRFP_ADD_AUTOCRYPT_HEADER 1
#define MRFP_NO_AUTOCRYPT_HEADER 2
#define DC_FP_ADD_AUTOCRYPT_HEADER 1
#define DC_FP_NO_AUTOCRYPT_HEADER 2
/* user functions */

View file

@ -34,7 +34,7 @@ typedef struct dc_keyring_t dc_keyring_t;
/* validation errors */
#define MRE2EE_NO_VALID_SIGNATURE 0x02
#define DC_E2EE_NO_VALID_SIGNATURE 0x02
/* misc. */
void dc_pgp_init (dc_context_t*);

View file

@ -143,7 +143,7 @@ dc_lot_t* dc_check_qr(dc_context_t* context, const char* qr)
if( semicolon ) { *semicolon = 0; }
}
else {
qr_parsed->m_state = MR_QR_ERROR;
qr_parsed->m_state = DC_QR_ERROR;
qr_parsed->m_text1 = dc_strdup("Bad e-mail address.");
goto cleanup;
}
@ -182,7 +182,7 @@ dc_lot_t* dc_check_qr(dc_context_t* context, const char* qr)
temp = dc_normalize_addr(addr); free(addr); addr = temp;
if( strlen(addr) < 3 || strchr(addr, '@')==NULL || strchr(addr, '.')==NULL ) {
qr_parsed->m_state = MR_QR_ERROR;
qr_parsed->m_state = DC_QR_ERROR;
qr_parsed->m_text1 = dc_strdup("Bad e-mail address.");
goto cleanup;
}
@ -190,7 +190,7 @@ dc_lot_t* dc_check_qr(dc_context_t* context, const char* qr)
if( fingerprint ) {
if( strlen(fingerprint) != 40 ) {
qr_parsed->m_state = MR_QR_ERROR;
qr_parsed->m_state = DC_QR_ERROR;
qr_parsed->m_text1 = dc_strdup("Bad fingerprint length in QR code.");
goto cleanup;
}
@ -211,15 +211,15 @@ dc_lot_t* dc_check_qr(dc_context_t* context, const char* qr)
locked = 1;
if( dc_apeerstate_load_by_fingerprint__(peerstate, context->m_sql, fingerprint) ) {
qr_parsed->m_state = MR_QR_FPR_OK;
qr_parsed->m_state = DC_QR_FPR_OK;
qr_parsed->m_id = dc_add_or_lookup_contact__(context, NULL, peerstate->m_addr, DC_ORIGIN_UNHANDLED_QR_SCAN, NULL);
dc_create_or_lookup_nchat_by_contact_id__(context, qr_parsed->m_id, DC_CHAT_DEADDROP_BLOCKED, &chat_id, NULL);
device_msg = dc_mprintf("%s verified.", peerstate->m_addr);
}
else {
qr_parsed->m_text1 = mr_format_fingerprint(fingerprint);
qr_parsed->m_state = MR_QR_FPR_WITHOUT_ADDR;
qr_parsed->m_text1 = dc_format_fingerprint(fingerprint);
qr_parsed->m_state = DC_QR_FPR_WITHOUT_ADDR;
}
dc_sqlite3_unlock(context->m_sql);
@ -234,12 +234,12 @@ dc_lot_t* dc_check_qr(dc_context_t* context, const char* qr)
locked = 1;
if( grpid && grpname ) {
qr_parsed->m_state = MR_QR_ASK_VERIFYGROUP;
qr_parsed->m_state = DC_QR_ASK_VERIFYGROUP;
qr_parsed->m_text1 = dc_strdup(grpname);
qr_parsed->m_text2 = dc_strdup(grpid);
}
else {
qr_parsed->m_state = MR_QR_ASK_VERIFYCONTACT;
qr_parsed->m_state = DC_QR_ASK_VERIFYCONTACT;
}
qr_parsed->m_id = dc_add_or_lookup_contact__(context, name, addr, DC_ORIGIN_UNHANDLED_QR_SCAN, NULL);
@ -254,17 +254,17 @@ dc_lot_t* dc_check_qr(dc_context_t* context, const char* qr)
}
else if( addr )
{
qr_parsed->m_state = MR_QR_ADDR;
qr_parsed->m_state = DC_QR_ADDR;
qr_parsed->m_id = dc_add_or_lookup_contact__(context, name, addr, DC_ORIGIN_UNHANDLED_QR_SCAN, NULL);
}
else if( strstr(qr, "http://")==qr || strstr(qr, "https://")==qr )
{
qr_parsed->m_state = MR_QR_URL;
qr_parsed->m_state = DC_QR_URL;
qr_parsed->m_text1 = dc_strdup(qr);
}
else
{
qr_parsed->m_state = MR_QR_TEXT;
qr_parsed->m_state = DC_QR_TEXT;
qr_parsed->m_text1 = dc_strdup(qr);
}

View file

@ -163,7 +163,7 @@ static int is_known_rfc724_mid_in_list__(dc_context_t* mailbox, const clist* mid
static int dc_is_reply_to_known_message__(dc_context_t* mailbox, dc_mimeparser_t* mime_parser)
{
/* check if the message is a reply to a known message; the replies are identified by the Message-ID from
`In-Reply-To`/`References:` (to support non-Delta-Clients) or from `Chat-Predecessor:` (Delta clients, see comment in mrchat.c) */
`In-Reply-To`/`References:` (to support non-Delta-Clients) or from `Chat-Predecessor:` (Delta clients, see comment in dc_chat.c) */
struct mailimf_optional_field* optional_field;
if( (optional_field=dc_mimeparser_lookup_optional_field2(mime_parser, "Chat-Predecessor", "X-MrPredecessor")) != NULL )
@ -641,7 +641,7 @@ static int check_verified_properties__(dc_context_t* mailbox, dc_mimeparser_t* m
&& strcmp(peerstate->m_verified_key_fingerprint, peerstate->m_gossip_key_fingerprint)!=0) )
{
dc_log_info(mailbox, 0, "Marking gossipped key %s as verified due to verified %s.", to_addr, contact->m_addr);
dc_apeerstate_set_verified(peerstate, MRA_GOSSIP_KEY, peerstate->m_gossip_key_fingerprint, DC_BIDIRECT_VERIFIED);
dc_apeerstate_set_verified(peerstate, DC_PS_GOSSIP_KEY, peerstate->m_gossip_key_fingerprint, DC_BIDIRECT_VERIFIED);
dc_apeerstate_save_to_db__(peerstate, mailbox->m_sql, 0);
is_verified = 1;
}
@ -943,7 +943,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
int incoming_origin = 0;
#define outgoing (!incoming)
dc_array_t* to_ids = NULL;
dc_array_t* to_ids = NULL;
int to_self = 0;
uint32_t from_id = 0;
@ -951,7 +951,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
uint32_t to_id = 0;
uint32_t chat_id = 0;
int chat_id_blocked = 0;
int state = MR_STATE_UNDEFINED;
int state = DC_STATE_UNDEFINED;
int hidden = 0;
sqlite3_stmt* stmt;
@ -961,7 +961,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
time_t sort_timestamp = DC_INVALID_TIMESTAMP;
time_t sent_timestamp = DC_INVALID_TIMESTAMP;
time_t rcvd_timestamp = DC_INVALID_TIMESTAMP;
dc_mimeparser_t* mime_parser = dc_mimeparser_new(mailbox->m_blobdir, mailbox);
dc_mimeparser_t* mime_parser = dc_mimeparser_new(mailbox->m_blobdir, mailbox);
int db_locked = 0;
int transaction_pending = 0;
const struct mailimf_field* field;
@ -991,7 +991,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
}
};
normally, this is done by mailimf_message_parse(), however, as we also need the MIME data,
we use mailmime_parse() through MrMimeParser (both call mailimf_struct_multiple_parse() somewhen, I did not found out anything
we use mailmime_parse() through dc_mimeparser (both call mailimf_struct_multiple_parse() somewhen, I did not found out anything
that speaks against this approach yet) */
dc_mimeparser_parse(mime_parser, imf_raw_not_terminated, imf_raw_bytes);
if( dc_hash_count(&mime_parser->m_header)==0 ) {
@ -1125,7 +1125,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
(of course, the user can add other chats manually later) */
if( incoming )
{
state = (flags&MR_IMAP_SEEN)? DC_STATE_IN_SEEN : DC_STATE_IN_FRESH;
state = (flags&DC_IMAP_SEEN)? DC_STATE_IN_SEEN : DC_STATE_IN_FRESH;
to_id = DC_CONTACT_ID_SELF;
// handshake messages must be processed before chats are crated (eg. contacs may be marked as verified)
@ -1254,7 +1254,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
/* correct message_timestamp, it should not be used before,
however, we cannot do this earlier as we need from_id to be set */
dc_calc_timestamps__(mailbox, chat_id, from_id, sent_timestamp, (flags&MR_IMAP_SEEN)? 0 : 1 /*fresh message?*/,
dc_calc_timestamps__(mailbox, chat_id, from_id, sent_timestamp, (flags&DC_IMAP_SEEN)? 0 : 1 /*fresh message?*/,
&sort_timestamp, &sent_timestamp, &rcvd_timestamp);
/* unarchive chat */
@ -1441,7 +1441,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
CAVE: we rely on dc_imap_markseen_msg() not to move messages that are already in the correct folder.
otherwise, the moved message get a new server_uid and is "fresh" again and we will be here again to move it away -
a classical deadlock, see also (***) in mrimap.c */
a classical deadlock, see also (***) in dc_imap.c */
if( mime_parser->m_is_send_by_messenger || mdn_consumed ) {
char* jobparam = dc_mprintf("%c=%s\n%c=%lu", DC_PARAM_SERVER_FOLDER, server_folder, DC_PARAM_SERVER_UID, server_uid);
dc_job_add(mailbox, DC_JOB_MARKSEEN_MDN_ON_IMAP, 0, jobparam, 0);

View file

@ -273,7 +273,7 @@ static void do_free_attr(char** attr, int* free_attr)
******************************************************************************/
const char* mrattr_find(char** attr, const char* key)
const char* dc_attr_find(char** attr, const char* key)
{
if( attr && key ) {
int i = 0;

View file

@ -20,8 +20,8 @@
******************************************************************************/
#ifndef __MRSAXPARSER_H__
#define __MRSAXPARSER_H__
#ifndef __DC_SAXPARSER_H__
#define __DC_SAXPARSER_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -37,7 +37,7 @@ typedef struct dc_saxparser_t
dc_saxparser_starttag_cb_t m_starttag_cb;
dc_saxparser_endtag_cb_t m_endtag_cb;
dc_saxparser_text_cb_t m_text_cb;
void* m_userdata;
void* m_userdata;
} dc_saxparser_t;
@ -47,7 +47,7 @@ void dc_saxparser_set_text_handler (dc_saxparser_t*, dc_saxparser_text
void dc_saxparser_parse (dc_saxparser_t*, const char* text);
const char* mrattr_find (char** attr, const char* key);
const char* dc_attr_find (char** attr, const char* key);
/*** library-private **********************************************************/
@ -56,5 +56,5 @@ const char* mrattr_find (char** attr, const char* key);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRSAXPARSER_H__ */
#endif /* __DC_SAXPARSER_H__ */

View file

@ -212,7 +212,7 @@ static int mark_peer_as_verified__(dc_context_t* context, const char* fingerprin
goto cleanup;
}
if( !dc_apeerstate_set_verified(peerstate, MRA_PUBLIC_KEY, fingerprint, DC_BIDIRECT_VERIFIED) ) {
if( !dc_apeerstate_set_verified(peerstate, DC_PS_PUBLIC_KEY, fingerprint, DC_BIDIRECT_VERIFIED) ) {
goto cleanup;
}
@ -266,7 +266,7 @@ static void send_handshake_msg(dc_context_t* context, uint32_t contact_chat_id,
}
if( strcmp(step, "vg-request")==0 || strcmp(step, "vc-request")==0 ) {
dc_param_set_int(msg->m_param, DC_PARAM_FORCE_PLAINTEXT, MRFP_ADD_AUTOCRYPT_HEADER); // the request message MUST NOT be encrypted - it may be that the key has changed and the message cannot be decrypted otherwise
dc_param_set_int(msg->m_param, DC_PARAM_FORCE_PLAINTEXT, DC_FP_ADD_AUTOCRYPT_HEADER); // the request message MUST NOT be encrypted - it may be that the key has changed and the message cannot be decrypted otherwise
}
else {
dc_param_set_int(msg->m_param, DC_PARAM_GUARANTEE_E2EE, 1); /* all but the first message MUST be encrypted */
@ -381,16 +381,16 @@ char* dc_get_securejoin_qr(dc_context_t* context, uint32_t group_chat_id)
locked = 1;
// invitenumber will be used to allow starting the handshake, auth will be used to verify the fingerprint
invitenumber = mrtoken_lookup__(context, MRT_INVITENUMBER, group_chat_id);
invitenumber = dc_token_lookup__(context, DC_TOKEN_INVITENUMBER, group_chat_id);
if( invitenumber == NULL ) {
invitenumber = dc_create_id();
mrtoken_save__(context, MRT_INVITENUMBER, group_chat_id, invitenumber);
dc_token_save__(context, DC_TOKEN_INVITENUMBER, group_chat_id, invitenumber);
}
auth = mrtoken_lookup__(context, MRT_AUTH, group_chat_id);
auth = dc_token_lookup__(context, DC_TOKEN_AUTH, group_chat_id);
if( auth == NULL ) {
auth = dc_create_id();
mrtoken_save__(context, MRT_AUTH, group_chat_id, auth);
dc_token_save__(context, DC_TOKEN_AUTH, group_chat_id, auth);
}
if( (self_addr = dc_sqlite3_get_config__(context->m_sql, "configured_addr", NULL)) == NULL ) {
@ -492,7 +492,7 @@ uint32_t dc_join_securejoin(dc_context_t* context, const char* qr)
}
if( ((qr_scan=dc_check_qr(context, qr))==NULL)
|| (qr_scan->m_state!=MR_QR_ASK_VERIFYCONTACT && qr_scan->m_state!=MR_QR_ASK_VERIFYGROUP) ) {
|| (qr_scan->m_state!=DC_QR_ASK_VERIFYCONTACT && qr_scan->m_state!=DC_QR_ASK_VERIFYGROUP) ) {
dc_log_error(context, 0, "Unknown QR code.");
goto cleanup;
}
@ -511,7 +511,7 @@ uint32_t dc_join_securejoin(dc_context_t* context, const char* qr)
CHECK_EXIT
join_vg = (qr_scan->m_state==MR_QR_ASK_VERIFYGROUP);
join_vg = (qr_scan->m_state==DC_QR_ASK_VERIFYGROUP);
s_bobs_status = 0;
dc_sqlite3_lock(context->m_sql);
@ -617,7 +617,7 @@ int dc_handle_securejoin_handshake(dc_context_t* context, dc_mimeparser_t* mimep
}
LOCK
if( mrtoken_exists__(context, MRT_INVITENUMBER, invitenumber) == 0 ) {
if( dc_token_exists__(context, DC_TOKEN_INVITENUMBER, invitenumber) == 0 ) {
dc_log_warning(context, 0, "Secure-join denied (bad invitenumber)."); // do not raise an error, this might just be spam or come from an old request
goto cleanup;
}
@ -639,7 +639,7 @@ int dc_handle_securejoin_handshake(dc_context_t* context, dc_mimeparser_t* mimep
// verify that Alice's Autocrypt key and fingerprint matches the QR-code
LOCK
if( s_bobs_qr_scan == NULL || s_bob_expects != VC_AUTH_REQUIRED || (join_vg && s_bobs_qr_scan->m_state!=MR_QR_ASK_VERIFYGROUP) ) {
if( s_bobs_qr_scan == NULL || s_bob_expects != VC_AUTH_REQUIRED || (join_vg && s_bobs_qr_scan->m_state!=DC_QR_ASK_VERIFYGROUP) ) {
dc_log_warning(context, 0, "auth-required message out of sync.");
goto cleanup; // no error, just aborted somehow or a mail from another handshake
}
@ -709,7 +709,7 @@ int dc_handle_securejoin_handshake(dc_context_t* context, dc_mimeparser_t* mimep
}
LOCK
if( mrtoken_exists__(context, MRT_AUTH, auth) == 0 ) {
if( dc_token_exists__(context, DC_TOKEN_AUTH, auth) == 0 ) {
dc_sqlite3_unlock(context->m_sql);
locked = 0;
could_not_establish_secure_connection(context, contact_chat_id, "Auth invalid.");
@ -775,7 +775,7 @@ int dc_handle_securejoin_handshake(dc_context_t* context, dc_mimeparser_t* mimep
}
LOCK
if( s_bobs_qr_scan == NULL || (join_vg && s_bobs_qr_scan->m_state!=MR_QR_ASK_VERIFYGROUP) ) {
if( s_bobs_qr_scan == NULL || (join_vg && s_bobs_qr_scan->m_state!=DC_QR_ASK_VERIFYGROUP) ) {
dc_log_warning(context, 0, "Message out of sync or belongs to a different handshake.");
goto cleanup;
}

View file

@ -35,7 +35,7 @@
******************************************************************************/
static int mr_is_empty_line(const char* buf)
static int is_empty_line(const char* buf)
{
const unsigned char* p1 = (const unsigned char*)buf; /* force unsigned - otherwise the `> ' '` comparison will fail */
while( *p1 ) {
@ -48,7 +48,7 @@ static int mr_is_empty_line(const char* buf)
}
static int mr_is_plain_quote(const char* buf)
static int is_plain_quote(const char* buf)
{
if( buf[0] == '>' ) {
return 1;
@ -57,7 +57,7 @@ static int mr_is_plain_quote(const char* buf)
}
static int mr_is_quoted_headline(const char* buf)
static int is_quoted_headline(const char* buf)
{
/* This function may be called for the line _directly_ before a quote.
The function checks if the line contains sth. like "On 01.02.2016, xy@z wrote:" in various languages.
@ -161,7 +161,7 @@ static char* dc_simplify_simplify_plain_text(dc_simplify_t* ths, const char* buf
char* line0 = (char*)carray_get(lines, l_first);
char* line1 = (char*)carray_get(lines, l_first+1);
char* line2 = (char*)carray_get(lines, l_first+2);
if( strcmp(line0, "---------- Forwarded message ----------")==0 /* do not chage this! sent exactly in this form in mrchat.c! */
if( strcmp(line0, "---------- Forwarded message ----------")==0 /* do not chage this! sent exactly in this form in dc_chat.c! */
&& strncmp(line1, "From: ", 6)==0
&& line2[0] == 0 )
{
@ -193,10 +193,10 @@ static char* dc_simplify_simplify_plain_text(dc_simplify_t* ths, const char* buf
for( l = l_last; l >= l_first; l-- ) {
line = (char*)carray_get(lines, l);
if( mr_is_plain_quote(line) ) {
if( is_plain_quote(line) ) {
l_lastQuotedLine = l;
}
else if( !mr_is_empty_line(line) ) {
else if( !is_empty_line(line) ) {
break;
}
}
@ -207,14 +207,14 @@ static char* dc_simplify_simplify_plain_text(dc_simplify_t* ths, const char* buf
ths->m_is_cut_at_end = 1;
if( l_last > 0 ) {
if( mr_is_empty_line((char*)carray_get(lines, l_last)) ) { /* allow one empty line between quote and quote headline (eg. mails from Jürgen) */
if( is_empty_line((char*)carray_get(lines, l_last)) ) { /* allow one empty line between quote and quote headline (eg. mails from Jürgen) */
l_last--;
}
}
if( l_last > 0 ) {
line = (char*)carray_get(lines, l_last);
if( mr_is_quoted_headline(line) ) {
if( is_quoted_headline(line) ) {
l_last--;
}
}
@ -228,11 +228,11 @@ static char* dc_simplify_simplify_plain_text(dc_simplify_t* ths, const char* buf
for( l = l_first; l <= l_last; l++ ) {
line = (char*)carray_get(lines, l);
if( mr_is_plain_quote(line) ) {
if( is_plain_quote(line) ) {
l_lastQuotedLine = l;
}
else if( !mr_is_empty_line(line) ) {
if( mr_is_quoted_headline(line) && !hasQuotedHeadline && l_lastQuotedLine == -1 ) {
else if( !is_empty_line(line) ) {
if( is_quoted_headline(line) && !hasQuotedHeadline && l_lastQuotedLine == -1 ) {
hasQuotedHeadline = 1; /* continue, the line may be a headline */
}
else {
@ -263,7 +263,7 @@ static char* dc_simplify_simplify_plain_text(dc_simplify_t* ths, const char* buf
{
line = (char*)carray_get(lines, l);
if( mr_is_empty_line(line) )
if( is_empty_line(line) )
{
pending_linebreaks++;
}
@ -320,7 +320,7 @@ char* dc_simplify_simplify(dc_simplify_t* ths, const char* in_unterminated, int
/* convert HTML to text, if needed */
if( is_html ) {
if( (temp = dc_dehtml(out)) != NULL ) { /* mr_dehtml() returns way too much lineends, however they're removed in the simplification below */
if( (temp = dc_dehtml(out)) != NULL ) { /* dc_dehtml() returns way too much lineends, however they're removed in the simplification below */
free(out);
out = temp;
}

View file

@ -20,8 +20,8 @@
******************************************************************************/
#ifndef __MRSIMPLIFY_H__
#define __MRSIMPLIFY_H__
#ifndef __DC_SIMPLIFY_H__
#define __DC_SIMPLIFY_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -38,16 +38,16 @@ typedef struct dc_simplify_t
dc_simplify_t* dc_simplify_new ();
void dc_simplify_unref (dc_simplify_t*);
void dc_simplify_unref (dc_simplify_t*);
/* Simplify and normalise text: Remove quotes, signatures, unnecessary
lineends etc.
The data returned from Simplify() must be free()'d when no longer used, private */
char* dc_simplify_simplify (dc_simplify_t*, const char* txt_unterminated, int txt_bytes, int is_html);
char* dc_simplify_simplify (dc_simplify_t*, const char* txt_unterminated, int txt_bytes, int is_html);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRSIMPLIFY_H__ */
#endif /* __DC_SIMPLIFY_H__ */

View file

@ -124,14 +124,14 @@ int dc_smtp_connect(dc_smtp_t* ths, const dc_loginparam_t* lp)
dc_log_error(ths->m_context, 0, "SMTP-object creation failed.");
goto cleanup;
}
mailsmtp_set_timeout(ths->m_hEtpan, MR_SMTP_TIMEOUT_SEC);
mailsmtp_set_timeout(ths->m_hEtpan, DC_SMTP_TIMEOUT_SEC);
mailsmtp_set_progress_callback(ths->m_hEtpan, body_progress, ths);
#if DEBUG_SMTP
mailsmtp_set_logger(ths->m_hEtpan, logger, ths);
#endif
/* connect to SMTP server */
if( lp->m_server_flags&(MR_SMTP_SOCKET_STARTTLS|MR_SMTP_SOCKET_PLAIN) )
if( lp->m_server_flags&(DC_LP_SMTP_SOCKET_STARTTLS|DC_LP_SMTP_SOCKET_PLAIN) )
{
if( (r=mailsmtp_socket_connect(ths->m_hEtpan, lp->m_send_server, lp->m_send_port)) != MAILSMTP_NO_ERROR ) {
dc_log_error_if(&ths->m_log_connect_errors, ths->m_context, 0, "SMTP-Socket connection to %s:%i failed (%s)", lp->m_send_server, (int)lp->m_send_port, mailsmtp_strerror(r));
@ -160,7 +160,7 @@ int dc_smtp_connect(dc_smtp_t* ths, const dc_loginparam_t* lp)
goto cleanup;
}
if( lp->m_server_flags&MR_SMTP_SOCKET_STARTTLS )
if( lp->m_server_flags&DC_LP_SMTP_SOCKET_STARTTLS )
{
if( (r=mailsmtp_socket_starttls(ths->m_hEtpan)) != MAILSMTP_NO_ERROR ) {
dc_log_error_if(&ths->m_log_connect_errors, ths->m_context, 0, "SMTP-STARTTLS failed (%s)", mailsmtp_strerror(r));
@ -181,7 +181,7 @@ int dc_smtp_connect(dc_smtp_t* ths, const dc_loginparam_t* lp)
}
dc_log_info(ths->m_context, 0, "SMTP-server %s:%i STARTTLS-connected.", lp->m_send_server, (int)lp->m_send_port);
}
else if( lp->m_server_flags&MR_SMTP_SOCKET_PLAIN )
else if( lp->m_server_flags&DC_LP_SMTP_SOCKET_PLAIN )
{
dc_log_info(ths->m_context, 0, "SMTP-server %s:%i connected.", lp->m_send_server, (int)lp->m_send_port);
}

View file

@ -20,8 +20,8 @@
******************************************************************************/
#ifndef __MRSMTP_H__
#define __MRSMTP_H__
#ifndef __DC_SMTP_H__
#define __DC_SMTP_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -55,5 +55,5 @@ int dc_smtp_send_msg (dc_smtp_t*, const clist* recipients, const ch
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRPARAM_H__ */
#endif /* __DC_SMTP_H__ */

View file

@ -141,7 +141,7 @@ void dc_sqlite3_unref(dc_sqlite3_t* ths)
}
if( ths->m_cobj ) {
pthread_mutex_lock(&ths->m_critical_); /* as a very exeception, we do the locking inside the mrsqlite3-class - normally, this should be done by the caller! */
pthread_mutex_lock(&ths->m_critical_); /* as a very exeception, we do the locking inside the dc_sqlite3-class - normally, this should be done by the caller! */
dc_sqlite3_close__(ths);
pthread_mutex_unlock(&ths->m_critical_);
}
@ -172,7 +172,7 @@ int dc_sqlite3_open__(dc_sqlite3_t* ths, const char* dbfile, int flags)
// However, locking is _also_ used for dc_context_t which _is_ still needed, so, we
// should remove locks only if we're really sure.
if( sqlite3_open_v2(dbfile, &ths->m_cobj,
SQLITE_OPEN_FULLMUTEX | ((flags&MR_OPEN_READONLY)? SQLITE_OPEN_READONLY : (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)),
SQLITE_OPEN_FULLMUTEX | ((flags&DC_OPEN_READONLY)? SQLITE_OPEN_READONLY : (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)),
NULL) != SQLITE_OK ) {
dc_sqlite3_log_error(ths, "Cannot open database \"%s\".", dbfile); /* ususally, even for errors, the pointer is set up (if not, this is also checked by dc_sqlite3_log_error()) */
goto cleanup;
@ -185,7 +185,7 @@ int dc_sqlite3_open__(dc_sqlite3_t* ths, const char* dbfile, int flags)
// (without a busy_timeout, sqlite3_step() would return SQLITE_BUSY at once)
sqlite3_busy_timeout(ths->m_cobj, 10*1000);
if( !(flags&MR_OPEN_READONLY) )
if( !(flags&DC_OPEN_READONLY) )
{
int dbversion_before_update = 0;
@ -217,7 +217,7 @@ int dc_sqlite3_open__(dc_sqlite3_t* ths, const char* dbfile, int flags)
" draft_timestamp INTEGER DEFAULT 0,"
" draft_txt TEXT DEFAULT '',"
" blocked INTEGER DEFAULT 0,"
" grpid TEXT DEFAULT ''," /* contacts-global unique group-ID, see mrchat.c for details */
" grpid TEXT DEFAULT ''," /* contacts-global unique group-ID, see dc_chat.c for details */
" param TEXT DEFAULT '');");
dc_sqlite3_execute__(ths, "CREATE INDEX chats_index1 ON chats (grpid);");
dc_sqlite3_execute__(ths, "CREATE TABLE chats_contacts (chat_id INTEGER, contact_id INTEGER);");
@ -696,32 +696,32 @@ int dc_sqlite3_set_config_int__(dc_sqlite3_t* ths, const char* key, int32_t valu
******************************************************************************/
#ifdef MR_USE_LOCK_DEBUG
#ifdef DC_USE_LOCK_DEBUG
void dc_sqlite3_lockNdebug(dc_sqlite3_t* ths, const char* filename, int linenum) /* wait and lock */
#else
void dc_sqlite3_lock(dc_sqlite3_t* ths) /* wait and lock */
#endif
{
#ifdef MR_USE_LOCK_DEBUG
#ifdef DC_USE_LOCK_DEBUG
clock_t start = clock();
dc_log_info(ths->m_context, 0, " waiting for lock at %s#L%i", filename, linenum);
#endif
pthread_mutex_lock(&ths->m_critical_);
#ifdef MR_USE_LOCK_DEBUG
#ifdef DC_USE_LOCK_DEBUG
dc_log_info(ths->m_context, 0, "{{{ LOCK AT %s#L%i after %.3f ms", filename, linenum, (double)(clock()-start)*1000.0/CLOCKS_PER_SEC);
#endif
}
#ifdef MR_USE_LOCK_DEBUG
#ifdef DC_USE_LOCK_DEBUG
void dc_sqlite3_unlockNdebug(dc_sqlite3_t* ths, const char* filename, int linenum)
#else
void dc_sqlite3_unlock(dc_sqlite3_t* ths)
#endif
{
#ifdef MR_USE_LOCK_DEBUG
#ifdef DC_USE_LOCK_DEBUG
dc_log_info(ths->m_context, 0, " UNLOCK AT %s#L%i }}}", filename, linenum);
#endif

View file

@ -20,8 +20,8 @@
******************************************************************************/
#ifndef __MRSQLITE3_H__
#define __MRSQLITE3_H__
#ifndef __DC_SQLITE3_H__
#define __DC_SQLITE3_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -157,19 +157,19 @@ enum
typedef struct dc_sqlite3_t
{
/** @privatesection */
sqlite3_stmt* m_pd[PREDEFINED_CNT]; /**< prepared statements - this is the favourite way for the caller to use SQLite */
sqlite3* m_cobj; /**< is the database given as dbfile to Open() */
int m_transactionCount; /**< helper for transactions */
dc_context_t* m_context; /**< used for logging and to acquire wakelocks, there may be N dc_sqlite3_t objects per mrmailbox! In practise, we use 2 on backup, 1 otherwise. */
sqlite3_stmt* m_pd[PREDEFINED_CNT]; /**< prepared statements - this is the favourite way for the caller to use SQLite */
sqlite3* m_cobj; /**< is the database given as dbfile to Open() */
int m_transactionCount; /**< helper for transactions */
dc_context_t* m_context; /**< used for logging and to acquire wakelocks, there may be N dc_sqlite3_t objects per context! In practise, we use 2 on backup, 1 otherwise. */
pthread_mutex_t m_critical_; /**< the user must make sure, only one thread uses sqlite at the same time! for this purpose, all calls must be enclosed by a locked m_critical; use dc_sqlite3_lock() for this purpose */
} dc_sqlite3_t;
dc_sqlite3_t* dc_sqlite3_new (dc_context_t*);
dc_sqlite3_t* dc_sqlite3_new (dc_context_t*);
void dc_sqlite3_unref (dc_sqlite3_t*);
#define MR_OPEN_READONLY 0x01
#define DC_OPEN_READONLY 0x01
int dc_sqlite3_open__ (dc_sqlite3_t*, const char* dbfile, int flags);
void dc_sqlite3_close__ (dc_sqlite3_t*);
@ -192,10 +192,10 @@ void dc_sqlite3_log_error (dc_sqlite3_t*, const char* msg, ...);
void dc_sqlite3_reset_all_predefinitions(dc_sqlite3_t*);
/* tools for locking, may be called nested, see also m_critical_ above.
the user of MrSqlite3 must make sure that the MrSqlite3-object is only used by one thread at the same time.
the user of dc_sqlite3 must make sure that the dc_sqlite3-object is only used by one thread at the same time.
In general, we will lock the hightest level as possible - this avoids deadlocks and massive on/off lockings.
Low-level-functions, eg. the MrSqlite3-methods, do not lock. */
#ifdef MR_USE_LOCK_DEBUG
Low-level-functions, eg. the dc_sqlite3-methods, do not lock. */
#ifdef DC_USE_LOCK_DEBUG
#define dc_sqlite3_lock(a) dc_sqlite3_lockNdebug((a), __FILE__, __LINE__)
#define dc_sqlite3_unlock(a) dc_sqlite3_unlockNdebug((a), __FILE__, __LINE__)
void dc_sqlite3_lockNdebug (dc_sqlite3_t*, const char* filename, int line);
@ -213,5 +213,5 @@ void dc_sqlite3_rollback__ (dc_sqlite3_t*);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRSQLITE3_H__ */
#endif /* __DC_SQLITE3_H__ */

View file

@ -27,7 +27,6 @@ extern "C" {
#endif
#include "mrmailbox.h"
#include <stdlib.h>
#include <string.h>

View file

@ -24,7 +24,7 @@
#include "dc_token.h"
void mrtoken_save__(dc_context_t* mailbox, mrtokennamespc_t namespc, uint32_t foreign_id, const char* token)
void dc_token_save__(dc_context_t* mailbox, dc_tokennamespc_t namespc, uint32_t foreign_id, const char* token)
{
sqlite3_stmt* stmt = NULL;
@ -45,7 +45,7 @@ cleanup:
}
char* mrtoken_lookup__(dc_context_t* mailbox, mrtokennamespc_t namespc, uint32_t foreign_id)
char* dc_token_lookup__(dc_context_t* mailbox, dc_tokennamespc_t namespc, uint32_t foreign_id)
{
char* token = NULL;
sqlite3_stmt* stmt = NULL;
@ -68,7 +68,7 @@ cleanup:
}
int mrtoken_exists__(dc_context_t* mailbox, mrtokennamespc_t namespc, const char* token)
int dc_token_exists__(dc_context_t* mailbox, dc_tokennamespc_t namespc, const char* token)
{
int exists = 0;
sqlite3_stmt* stmt = NULL;

View file

@ -20,8 +20,8 @@
******************************************************************************/
#ifndef __MRTOKEN_H__
#define __MRTOKEN_H__
#ifndef __DC_TOKEN_H__
#define __DC_TOKEN_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -29,19 +29,19 @@ extern "C" {
// Token namespaces
typedef enum {
MRT_INVITENUMBER = 100,
MRT_AUTH = 110
} mrtokennamespc_t;
DC_TOKEN_INVITENUMBER = 100,
DC_TOKEN_AUTH = 110
} dc_tokennamespc_t;
// Functions to read/write token from/to the database. A token is any string associated with a key.
void mrtoken_save__ (dc_context_t*, mrtokennamespc_t, uint32_t foreign_id, const char* token);
char* mrtoken_lookup__ (dc_context_t*, mrtokennamespc_t, uint32_t foreign_id);
int mrtoken_exists__ (dc_context_t*, mrtokennamespc_t, const char* token);
void dc_token_save__ (dc_context_t*, dc_tokennamespc_t, uint32_t foreign_id, const char* token);
char* dc_token_lookup__ (dc_context_t*, dc_tokennamespc_t, uint32_t foreign_id);
int dc_token_exists__ (dc_context_t*, dc_tokennamespc_t, const char* token);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRTOKEN_H__ */
#endif /* __DC_TOKEN_H__ */

View file

@ -410,7 +410,7 @@ error:
#if 0 /* not needed at the moment */
static size_t mr_utf8_strlen(const char* s)
static size_t dc_utf8_strlen(const char* s)
{
size_t i = 0, j = 0;
while( s[i] ) {
@ -423,7 +423,7 @@ static size_t mr_utf8_strlen(const char* s)
#endif
static size_t mr_utf8_strnlen(const char* s, size_t n)
static size_t dc_utf8_strnlen(const char* s, size_t n)
{
size_t i = 0, j = 0;
while( i < n ) {
@ -450,7 +450,7 @@ void dc_truncate_n_unwrap_str(char* buf, int approx_characters, int do_unwrap)
else {
if( lastIsCharacter ) {
size_t used_bytes = (size_t)((uintptr_t)p1 - (uintptr_t)buf);
if( mr_utf8_strnlen(buf, used_bytes) >= approx_characters ) {
if( dc_utf8_strnlen(buf, used_bytes) >= approx_characters ) {
size_t buf_bytes = strlen(buf);
if( buf_bytes-used_bytes >= strlen(ellipse_utf8) /* check if we have room for the ellipse */ ) {
strcpy((char*)p1, ellipse_utf8);
@ -764,7 +764,7 @@ struct mailimap_date_time* dc_timestamp_to_mailimap_date_time(time_t timeval)
static time_t s_last_smeared_timestamp = 0;
#define MR_MAX_SECONDS_TO_LEND_FROM_FUTURE 5
#define DC_MAX_SECONDS_TO_LEND_FROM_FUTURE 5
time_t dc_create_smeared_timestamp__(void)
@ -773,8 +773,8 @@ time_t dc_create_smeared_timestamp__(void)
time_t ret = now;
if( ret <= s_last_smeared_timestamp ) {
ret = s_last_smeared_timestamp+1;
if( (ret-now) > MR_MAX_SECONDS_TO_LEND_FROM_FUTURE ) {
ret = now + MR_MAX_SECONDS_TO_LEND_FROM_FUTURE;
if( (ret-now) > DC_MAX_SECONDS_TO_LEND_FROM_FUTURE ) {
ret = now + DC_MAX_SECONDS_TO_LEND_FROM_FUTURE;
}
}
s_last_smeared_timestamp = ret;
@ -786,7 +786,7 @@ time_t dc_create_smeared_timestamps__(int count)
{
/* get a range to timestamps that can be used uniquely */
time_t now = time(NULL);
time_t start = now + DC_MIN(count, MR_MAX_SECONDS_TO_LEND_FROM_FUTURE) - count;
time_t start = now + DC_MIN(count, DC_MAX_SECONDS_TO_LEND_FROM_FUTURE) - count;
start = DC_MAX(s_last_smeared_timestamp+1, start);
s_last_smeared_timestamp = start+(count-1);
@ -941,9 +941,9 @@ char* dc_extract_grpid_from_rfc724_mid(const char* mid)
}
*p1 = 0;
#define MR_ALSO_VALID_ID_LEN 16 /* length returned by create_adhoc_grp_id__() */
#define DC_ALSO_VALID_ID_LEN 16 /* length returned by create_adhoc_grp_id__() */
grpid_len = strlen(grpid);
if( grpid_len!=DC_CREATE_ID_LEN && grpid_len!=MR_ALSO_VALID_ID_LEN ) { /* strict length comparison, the 'Gr.' magic is weak enough */
if( grpid_len!=DC_CREATE_ID_LEN && grpid_len!=DC_ALSO_VALID_ID_LEN ) { /* strict length comparison, the 'Gr.' magic is weak enough */
goto cleanup;
}
@ -1036,8 +1036,8 @@ int dc_delete_file(const char* pathNfilename, dc_context_t* log/*may be NULL*/)
int dc_copy_file(const char* src, const char* dest, dc_context_t* log/*may be NULL*/)
{
int success = 0, fd_src = -1, fd_dest = -1;
#define MR_COPY_BUF_SIZE 4096
char buf[MR_COPY_BUF_SIZE];
#define DC_COPY_BUF_SIZE 4096
char buf[DC_COPY_BUF_SIZE];
size_t bytes_read;
int anything_copied = 0;
@ -1055,7 +1055,7 @@ int dc_copy_file(const char* src, const char* dest, dc_context_t* log/*may be NU
goto cleanup;
}
while( (bytes_read=read(fd_src, buf, MR_COPY_BUF_SIZE)) > 0 ) {
while( (bytes_read=read(fd_src, buf, DC_COPY_BUF_SIZE)) > 0 ) {
if (write(fd_dest, buf, bytes_read) != bytes_read) {
dc_log_error(log, 0, "Cannot write %i bytes to \"%s\".", bytes_read, dest);
}
@ -1131,7 +1131,7 @@ void dc_split_filename(const char* pathNfilename, char** ret_basename, char** re
void mr_validate_filename(char* filename)
void dc_validate_filename(char* filename)
{
/* function modifies the given buffer and replaces all characters not valid in filenames by a "-" */
char* p1 = filename;
@ -1152,7 +1152,7 @@ char* dc_get_fine_pathNfilename(const char* folder, const char* desired_filename
int i;
filenameNsuffix = dc_strdup(desired_filenameNsuffix__);
mr_validate_filename(filenameNsuffix);
dc_validate_filename(filenameNsuffix);
dc_split_filename(filenameNsuffix, &basename, &dotNSuffix);
for( i = 0; i < 1000 /*no deadlocks, please*/; i++ ) {

View file

@ -47,11 +47,11 @@
*
* @return If uuencoded parts are found in the given text, the function returns the
* given text stripped by the first uuencode block.
* The caller will call mruudecode_do() again with this remaining text then.
* The caller will call dc_uudecode_do() again with this remaining text then.
* This way, multiple uuencoded parts can be stripped from a text.
* If no uuencoded parts are found or on errors, NULL is returned.
*/
char* mruudecode_do(const char* text, char** ret_binary, size_t* ret_binary_bytes, char** ret_filename)
char* dc_uudecode_do(const char* text, char** ret_binary, size_t* ret_binary_bytes, char** ret_filename)
{
// CAVE: This function may be called in a loop until it returns NULL, so make sure not to create an invinitive look.

View file

@ -20,18 +20,18 @@
******************************************************************************/
#ifndef __MRUUDECODE_H__
#define __MRUUDECODE_H__
#ifndef __DC_UUDECODE_H__
#define __DC_UUDECODE_H__
#ifdef __cplusplus
extern "C" {
#endif
char* mruudecode_do(const char* text, char** ret_binary, size_t* ret_binary_bytes, char** ret_filename);
char* dc_uudecode_do(const char* text, char** ret_binary, size_t* ret_binary_bytes, char** ret_filename);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRUUDECODE_H__ */
#endif /* __DC_UUDECODE_H__ */

View file

@ -180,8 +180,6 @@ extern "C" {
#define MR_STATE_OUT_ERROR DC_STATE_OUT_ERROR
#define MR_STATE_OUT_DELIVERED DC_STATE_OUT_DELIVERED
#define MR_STATE_OUT_MDN_RCVD DC_STATE_OUT_MDN_RCVD
#define MR_MAX_GET_TEXT_LEN DC_MAX_GET_TEXT_LEN
#define MR_MAX_GET_INFO_LEN DC_MAX_GET_INFO_LEN
#define mrmsg_new dc_msg_new
#define mrmsg_unref dc_msg_unref
#define mrmsg_empty dc_msg_empty