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

refactor stock, state, origin

This commit is contained in:
B. Petersen 2018-06-25 18:35:10 +02:00
parent 41037ef714
commit 31f80e3f1a
23 changed files with 383 additions and 383 deletions

View file

@ -49,7 +49,7 @@ dc_chat_t* dc_chat_new(dc_context_t* mailbox)
ths->m_magic = MR_CHAT_MAGIC;
ths->m_context = mailbox;
ths->m_type = MR_CHAT_TYPE_UNDEFINED;
ths->m_type = DC_CHAT_TYPE_UNDEFINED;
ths->m_param = dc_param_new();
return ths;
@ -101,7 +101,7 @@ void dc_chat_empty(dc_chat_t* chat)
free(chat->m_draft_text);
chat->m_draft_text = NULL;
chat->m_type = MR_CHAT_TYPE_UNDEFINED;
chat->m_type = DC_CHAT_TYPE_UNDEFINED;
chat->m_id = 0;
free(chat->m_grpid);
@ -168,7 +168,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 ) {
return MR_CHAT_TYPE_UNDEFINED;
return DC_CHAT_TYPE_UNDEFINED;
}
return chat->m_type;
}
@ -221,11 +221,11 @@ char* dc_chat_get_subtitle(dc_chat_t* chat)
return safe_strdup("Err");
}
if( chat->m_type == MR_CHAT_TYPE_SINGLE && dc_param_exists(chat->m_param, DC_PARAM_SELFTALK) )
if( chat->m_type == DC_CHAT_TYPE_SINGLE && dc_param_exists(chat->m_param, DC_PARAM_SELFTALK) )
{
ret = mrstock_str(MR_STR_SELFTALK_SUBTITLE);
ret = dc_stock_str(DC_STR_SELFTALK_SUBTITLE);
}
else if( chat->m_type == MR_CHAT_TYPE_SINGLE )
else if( chat->m_type == DC_CHAT_TYPE_SINGLE )
{
int r;
dc_sqlite3_lock(chat->m_context->m_sql);
@ -243,19 +243,19 @@ char* dc_chat_get_subtitle(dc_chat_t* chat)
dc_sqlite3_unlock(chat->m_context->m_sql);
}
else if( MR_CHAT_TYPE_IS_MULTI(chat->m_type) )
else if( DC_CHAT_TYPE_IS_MULTI(chat->m_type) )
{
int cnt = 0;
if( chat->m_id == MR_CHAT_ID_DEADDROP )
if( chat->m_id == DC_CHAT_ID_DEADDROP )
{
ret = mrstock_str(MR_STR_DEADDROP); /* typically, the subtitle for the deaddropn is not displayed at all */
ret = dc_stock_str(DC_STR_DEADDROP); /* typically, the subtitle for the deaddropn is not displayed at all */
}
else
{
dc_sqlite3_lock(chat->m_context->m_sql);
cnt = dc_get_chat_contact_count__(chat->m_context, chat->m_id);
ret = mrstock_str_repl_pl(MR_STR_MEMBER, cnt /*SELF is included in group chats (if not removed)*/);
ret = dc_stock_str_repl_pl(DC_STR_MEMBER, cnt /*SELF is included in group chats (if not removed)*/);
dc_sqlite3_unlock(chat->m_context->m_sql);
}
@ -396,7 +396,7 @@ int dc_chat_is_verified(dc_chat_t* chat)
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
return 0;
}
return (chat->m_type==MR_CHAT_TYPE_VERIFIED_GROUP);
return (chat->m_type==DC_CHAT_TYPE_VERIFIED_GROUP);
}
@ -409,7 +409,7 @@ int dc_chat_are_all_members_verified__(dc_chat_t* chat)
goto cleanup;
}
if( chat->m_id == MR_CHAT_ID_DEADDROP || chat->m_id == MR_CHAT_ID_STARRED ) {
if( chat->m_id == DC_CHAT_ID_DEADDROP || chat->m_id == DC_CHAT_ID_STARRED ) {
goto cleanup; // deaddrop & co. are never verified
}
@ -424,7 +424,7 @@ int dc_chat_are_all_members_verified__(dc_chat_t* chat)
{
uint32_t contact_id = sqlite3_column_int(stmt, 0);
int has_verified_key = sqlite3_column_int(stmt, 1);
if( contact_id != MR_CONTACT_ID_SELF
if( contact_id != DC_CONTACT_ID_SELF
&& !has_verified_key )
{
goto cleanup; // a single unverified contact results in an unverified chat
@ -506,23 +506,23 @@ static int dc_chat_set_from_stmt__(dc_chat_t* ths, sqlite3_stmt* row)
}
/* correct the title of some special groups */
if( ths->m_id == MR_CHAT_ID_DEADDROP ) {
if( ths->m_id == DC_CHAT_ID_DEADDROP ) {
free(ths->m_name);
ths->m_name = mrstock_str(MR_STR_DEADDROP);
ths->m_name = dc_stock_str(DC_STR_DEADDROP);
}
else if( ths->m_id == MR_CHAT_ID_ARCHIVED_LINK ) {
else if( ths->m_id == DC_CHAT_ID_ARCHIVED_LINK ) {
free(ths->m_name);
char* tempname = mrstock_str(MR_STR_ARCHIVEDCHATS);
char* tempname = dc_stock_str(DC_STR_ARCHIVEDCHATS);
ths->m_name = dc_mprintf("%s (%i)", tempname, dc_get_archived_count__(ths->m_context));
free(tempname);
}
else if( ths->m_id == MR_CHAT_ID_STARRED ) {
else if( ths->m_id == DC_CHAT_ID_STARRED ) {
free(ths->m_name);
ths->m_name = mrstock_str(MR_STR_STARREDMSGS);
ths->m_name = dc_stock_str(DC_STR_STARREDMSGS);
}
else if( dc_param_exists(ths->m_param, DC_PARAM_SELFTALK) ) {
free(ths->m_name);
ths->m_name = mrstock_str(MR_STR_SELF);
ths->m_name = dc_stock_str(DC_STR_SELF);
}
return row_offset; /* success, return the next row offset */

View file

@ -20,17 +20,17 @@
******************************************************************************/
#ifndef __MRCHAT_PRIVATE_H__
#define __MRCHAT_PRIVATE_H__
#ifndef __DC_CHAT_H__
#define __DC_CHAT_H__
#ifdef __cplusplus
extern "C" {
#endif
/* values for the chats.blocked database field */
#define MR_CHAT_NOT_BLOCKED 0
#define MR_CHAT_MANUALLY_BLOCKED 1
#define MR_CHAT_DEADDROP_BLOCKED 2
#define DC_CHAT_NOT_BLOCKED 0
#define DC_CHAT_MANUALLY_BLOCKED 1
#define DC_CHAT_DEADDROP_BLOCKED 2
/** the structure behind dc_chat_t */
@ -44,10 +44,10 @@ struct _dc_chat
char* m_draft_text; /**< Draft text. NULL if there is no draft. */
time_t m_draft_timestamp; /**< Timestamp of the draft. 0 if there is no draft. */
int m_archived; /**< Archived state. Better use dc_chat_get_archived() to access this object. */
dc_context_t* m_context; /**< The mailbox object the chat belongs to. */
dc_context_t* m_context; /**< The mailbox object the chat belongs to. */
char* m_grpid; /**< Group ID that is used by all clients. Only used if the chat is a group. NULL if unset */
int m_blocked; /**< One of MR_CHAT_*_BLOCKED */
dc_param_t* m_param; /**< Additional parameters for a chat. Should not be used directly. */
int m_blocked; /**< One of DC_CHAT_*_BLOCKED */
dc_param_t* m_param; /**< Additional parameters for a chat. Should not be used directly. */
};
@ -56,15 +56,15 @@ int dc_chat_update_param__ (dc_chat_t*);
int dc_chat_are_all_members_verified__ (dc_chat_t*);
#define MR_CHAT_TYPE_IS_MULTI(a) ((a)==MR_CHAT_TYPE_GROUP || (a)==MR_CHAT_TYPE_VERIFIED_GROUP)
#define MR_CHAT_TYPE_CAN_SEND(a) ((a)==MR_CHAT_TYPE_SINGLE || (a)==MR_CHAT_TYPE_GROUP || (a)==MR_CHAT_TYPE_VERIFIED_GROUP)
#define DC_CHAT_TYPE_IS_MULTI(a) ((a)==DC_CHAT_TYPE_GROUP || (a)==DC_CHAT_TYPE_VERIFIED_GROUP)
#define DC_CHAT_TYPE_CAN_SEND(a) ((a)==DC_CHAT_TYPE_SINGLE || (a)==DC_CHAT_TYPE_GROUP || (a)==DC_CHAT_TYPE_VERIFIED_GROUP)
#define MR_CHAT_PREFIX "Chat:" /* you MUST NOT modify this or the following strings */
#define MR_CHATS_FOLDER "DeltaChat" // make sure not to use reserved words here, eg. "Chats" or "Chat" are reserved in gmail
#define DC_CHAT_PREFIX "Chat:" /* you MUST NOT modify this or the following strings */
#define DC_CHATS_FOLDER "DeltaChat" // make sure not to use reserved words here, eg. "Chats" or "Chat" are reserved in gmail
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRCHAT_PRIVATE_H__ */
#endif /* __DC_CHAT_H__ */

View file

@ -232,7 +232,7 @@ dc_lot_t* dc_chatlist_get_summary(dc_chatlist_t* chatlist, size_t index, dc_chat
lastmsg = dc_msg_new();
dc_msg_load_from_db__(lastmsg, chatlist->m_context, lastmsg_id);
if( lastmsg->m_from_id != MR_CONTACT_ID_SELF && MR_CHAT_TYPE_IS_MULTI(chat->m_type) )
if( lastmsg->m_from_id != DC_CONTACT_ID_SELF && DC_CHAT_TYPE_IS_MULTI(chat->m_type) )
{
lastcontact = dc_contact_new(chatlist->m_context);
dc_contact_load_from_db__(lastcontact, chatlist->m_context->m_sql, lastmsg->m_from_id);
@ -243,7 +243,7 @@ dc_lot_t* dc_chatlist_get_summary(dc_chatlist_t* chatlist, size_t index, dc_chat
dc_sqlite3_unlock(chatlist->m_context->m_sql);
locked = 0;
if( chat->m_id == MR_CHAT_ID_ARCHIVED_LINK )
if( chat->m_id == DC_CHAT_ID_ARCHIVED_LINK )
{
ret->m_text2 = safe_strdup(NULL);
}
@ -252,7 +252,7 @@ dc_lot_t* dc_chatlist_get_summary(dc_chatlist_t* chatlist, size_t index, dc_chat
&& (lastmsg==NULL || chat->m_draft_timestamp>lastmsg->m_timestamp) )
{
/* show the draft as the last message */
ret->m_text1 = mrstock_str(MR_STR_DRAFT);
ret->m_text1 = dc_stock_str(DC_STR_DRAFT);
ret->m_text1_meaning = MR_TEXT1_DRAFT;
ret->m_text2 = safe_strdup(chat->m_draft_text);
@ -263,7 +263,7 @@ dc_lot_t* dc_chatlist_get_summary(dc_chatlist_t* chatlist, size_t index, dc_chat
else if( lastmsg == NULL || lastmsg->m_from_id == 0 )
{
/* no messages */
ret->m_text2 = mrstock_str(MR_STR_NOMESSAGES);
ret->m_text2 = dc_stock_str(DC_STR_NOMESSAGES);
}
else
{
@ -323,7 +323,7 @@ int dc_chatlist_load_from_db__(dc_chatlist_t* ths, int listflags, const char* qu
/* select example with left join and minimum: http://stackoverflow.com/questions/7588142/mysql-left-join-min */
#define QUR1 "SELECT c.id, m.id FROM chats c " \
" LEFT JOIN msgs m ON (c.id=m.chat_id AND m.hidden=0 AND m.timestamp=(SELECT MAX(timestamp) FROM msgs WHERE chat_id=c.id AND hidden=0)) " /* not: `m.hidden` which would refer the outer select and takes lot of time*/ \
" WHERE c.id>" DC_STRINGIFY(MR_CHAT_ID_LAST_SPECIAL) " AND c.blocked=0"
" WHERE c.id>" DC_STRINGIFY(DC_CHAT_ID_LAST_SPECIAL) " AND c.blocked=0"
#define QUR2 " GROUP BY c.id " /* GROUP BY is needed as there may be several messages with the same timestamp */ \
" ORDER BY MAX(c.draft_timestamp, IFNULL(m.timestamp,0)) DESC,m.id DESC;" /* the list starts with the newest chats */
@ -352,7 +352,7 @@ int dc_chatlist_load_from_db__(dc_chatlist_t* ths, int listflags, const char* qu
if( !(listflags & MR_GCL_NO_SPECIALS) ) {
uint32_t last_deaddrop_fresh_msg_id = dc_get_last_deaddrop_fresh_msg__(ths->m_context);
if( last_deaddrop_fresh_msg_id > 0 ) {
dc_array_add_id(ths->m_chatNlastmsg_ids, MR_CHAT_ID_DEADDROP); /* show deaddrop with the last fresh message */
dc_array_add_id(ths->m_chatNlastmsg_ids, DC_CHAT_ID_DEADDROP); /* show deaddrop with the last fresh message */
dc_array_add_id(ths->m_chatNlastmsg_ids, last_deaddrop_fresh_msg_id);
}
add_archived_link_item = 1;
@ -384,7 +384,7 @@ int dc_chatlist_load_from_db__(dc_chatlist_t* ths, int listflags, const char* qu
if( add_archived_link_item && dc_get_archived_count__(ths->m_context)>0 )
{
dc_array_add_id(ths->m_chatNlastmsg_ids, MR_CHAT_ID_ARCHIVED_LINK);
dc_array_add_id(ths->m_chatNlastmsg_ids, DC_CHAT_ID_ARCHIVED_LINK);
dc_array_add_id(ths->m_chatNlastmsg_ids, 0);
}

View file

@ -283,7 +283,7 @@ int dc_contact_is_verified__(const dc_contact_t* contact, const dc_apeerstate_t*
goto cleanup;
}
if( contact->m_id == MR_CONTACT_ID_SELF ) {
if( contact->m_id == DC_CONTACT_ID_SELF ) {
contact_verified = DC_BIDIRECT_VERIFIED;
goto cleanup; // we're always sort of secured-verified as we could verify the key on this device any time with the key on this device
}
@ -470,10 +470,10 @@ int dc_contact_load_from_db__(dc_contact_t* ths, dc_sqlite3_t* sql, uint32_t con
dc_contact_empty(ths);
if( contact_id == MR_CONTACT_ID_SELF )
if( contact_id == DC_CONTACT_ID_SELF )
{
ths->m_id = contact_id;
ths->m_name = mrstock_str(MR_STR_SELF);
ths->m_name = dc_stock_str(DC_STR_SELF);
ths->m_addr = dc_sqlite3_get_config__(sql, "configured_addr", "");
}
else

View file

@ -43,40 +43,40 @@ struct _dc_contact
* The contact ID.
*
* Special message IDs:
* - MR_CONTACT_ID_SELF (1) - this is the owner of the mailbox with the email-address set by dc_set_config() using "addr".
* - DC_CONTACT_ID_SELF (1) - this is the owner of the mailbox with the email-address set by dc_set_config() using "addr".
*
* Normal contact IDs are larger than these special ones (larger than MR_CONTACT_ID_LAST_SPECIAL).
* Normal contact IDs are larger than these special ones (larger than DC_CONTACT_ID_LAST_SPECIAL).
*/
uint32_t m_id;
char* m_name; /**< Contact name. It is recommended to use dc_contact_get_name(), dc_contact_get_display_name() or dc_contact_get_name_n_addr() to access this field. May be NULL or empty, initially set to #m_authname. */
char* m_authname; /**< Name authorized by the contact himself. Only this name may be spread to others, e.g. in To:-lists. May be NULL or empty. It is recommended to use dc_contact_get_name(), dc_contact_get_display_name() or dc_contact_get_name_n_addr() to access this field. */
char* m_addr; /**< E-Mail-Address of the contact. It is recommended to use dc_contact_get_addr() to access this field. May be NULL. */
int m_blocked; /**< Blocked state. Use dc_contact_is_blocked() to access this field. */
int m_origin; /**< The origin/source of the contact. One of the MR_ORIGIN_* constants. */
int m_origin; /**< The origin/source of the contact. One of the DC_ORIGIN_* constants. */
};
/* library-internal */
#define MR_ORIGIN_INCOMING_UNKNOWN_FROM 0x10 /* From: of incoming messages of unknown sender */
#define MR_ORIGIN_INCOMING_UNKNOWN_CC 0x20 /* Cc: of incoming messages of unknown sender */
#define MR_ORIGIN_INCOMING_UNKNOWN_TO 0x40 /* To: of incoming messages of unknown sender */
#define MR_ORIGIN_UNHANDLED_QR_SCAN 0x80 /* address scanned but not verified */
#define MR_ORIGIN_INCOMING_REPLY_TO 0x100 /* Reply-To: of incoming message of known sender */
#define MR_ORIGIN_INCOMING_CC 0x200 /* Cc: of incoming message of known sender */
#define MR_ORIGIN_INCOMING_TO 0x400 /* additional To:'s of incoming message of known sender */
#define MR_ORIGIN_CREATE_CHAT 0x800 /* a chat was manually created for this user, but no message yet sent */
#define MR_ORIGIN_OUTGOING_BCC 0x1000 /* message sent by us */
#define MR_ORIGIN_OUTGOING_CC 0x2000 /* message sent by us */
#define MR_ORIGIN_OUTGOING_TO 0x4000 /* message sent by us */
#define MR_ORIGIN_INTERNAL 0x40000 /* internal use */
#define MR_ORIGIN_ADRESS_BOOK 0x80000 /* address is in our address book */
#define MR_ORIGIN_SECUREJOIN_INVITED 0x1000000 /* set on Alice's side for contacts like Bob that have scanned the QR code offered by her. Only means the contact has once been established using the "securejoin" procedure in the past, getting the current key verification status requires calling dc_contact_is_verfied() ! */
#define MR_ORIGIN_SECUREJOIN_JOINED 0x2000000 /* set on Bob's side for contacts scanned and verified from a QR code. Only means the contact has once been established using the "securejoin" procedure in the past, getting the current key verification status requires calling dc_contact_is_verfied() ! */
#define MR_ORIGIN_MANUALLY_CREATED 0x4000000 /* contact added mannually by dc_create_contact(), this should be the largets origin as otherwise the user cannot modify the names */
#define DC_ORIGIN_INCOMING_UNKNOWN_FROM 0x10 /* From: of incoming messages of unknown sender */
#define DC_ORIGIN_INCOMING_UNKNOWN_CC 0x20 /* Cc: of incoming messages of unknown sender */
#define DC_ORIGIN_INCOMING_UNKNOWN_TO 0x40 /* To: of incoming messages of unknown sender */
#define DC_ORIGIN_UNHANDLED_QR_SCAN 0x80 /* address scanned but not verified */
#define DC_ORIGIN_INCOMING_REPLY_TO 0x100 /* Reply-To: of incoming message of known sender */
#define DC_ORIGIN_INCOMING_CC 0x200 /* Cc: of incoming message of known sender */
#define DC_ORIGIN_INCOMING_TO 0x400 /* additional To:'s of incoming message of known sender */
#define DC_ORIGIN_CREATE_CHAT 0x800 /* a chat was manually created for this user, but no message yet sent */
#define DC_ORIGIN_OUTGOING_BCC 0x1000 /* message sent by us */
#define DC_ORIGIN_OUTGOING_CC 0x2000 /* message sent by us */
#define DC_ORIGIN_OUTGOING_TO 0x4000 /* message sent by us */
#define DC_ORIGIN_INTERNAL 0x40000 /* internal use */
#define DC_ORIGIN_ADRESS_BOOK 0x80000 /* address is in our address book */
#define DC_ORIGIN_SECUREJOIN_INVITED 0x1000000 /* set on Alice's side for contacts like Bob that have scanned the QR code offered by her. Only means the contact has once been established using the "securejoin" procedure in the past, getting the current key verification status requires calling dc_contact_is_verfied() ! */
#define DC_ORIGIN_SECUREJOIN_JOINED 0x2000000 /* set on Bob's side for contacts scanned and verified from a QR code. Only means the contact has once been established using the "securejoin" procedure in the past, getting the current key verification status requires calling dc_contact_is_verfied() ! */
#define DC_ORIGIN_MANUALLY_CREATED 0x4000000 /* contact added mannually by dc_create_contact(), this should be the largets origin as otherwise the user cannot modify the names */
#define MR_ORIGIN_MIN_CONTACT_LIST (MR_ORIGIN_INCOMING_REPLY_TO) /* contacts with at least this origin value are shown in the contact list */
#define MR_ORIGIN_MIN_VERIFIED (MR_ORIGIN_INCOMING_REPLY_TO) /* contacts with at least this origin value are verified and known not to be spam */
#define MR_ORIGIN_MIN_START_NEW_NCHAT (0x7FFFFFFF) /* contacts with at least this origin value start a new "normal" chat, defaults to off */
#define DC_ORIGIN_MIN_CONTACT_LIST (DC_ORIGIN_INCOMING_REPLY_TO) /* contacts with at least this origin value are shown in the contact list */
#define DC_ORIGIN_MIN_VERIFIED (DC_ORIGIN_INCOMING_REPLY_TO) /* contacts with at least this origin value are verified and known not to be spam */
#define DC_ORIGIN_MIN_START_NEW_NCHAT (0x7FFFFFFF) /* contacts with at least this origin value start a new "normal" chat, defaults to off */
int dc_contact_load_from_db__ (dc_contact_t*, dc_sqlite3_t*, uint32_t contact_id);
int dc_contact_is_verified__ (const dc_contact_t*, const dc_apeerstate_t*);

View file

@ -172,7 +172,7 @@ void dc_context_unref(dc_context_t* context)
pthread_cond_destroy(&context->m_smtpidle_cond);
pthread_mutex_destroy(&context->m_smtpidle_condmutex);
for( int i = 0; i < MR_LOG_RINGBUF_SIZE; i++ ) {
for( int i = 0; i < DC_LOG_RINGBUF_SIZE; i++ ) {
free(context->m_log_ringbuf[i]);
}
@ -613,8 +613,8 @@ char* dc_get_info(dc_context_t* context)
/* add log excerpt */
pthread_mutex_lock(&context->m_log_ringbuf_critical); /*take care not to log here! */
for( int i = 0; i < MR_LOG_RINGBUF_SIZE; i++ ) {
int j = (context->m_log_ringbuf_pos+i) % MR_LOG_RINGBUF_SIZE;
for( int i = 0; i < DC_LOG_RINGBUF_SIZE; i++ ) {
int j = (context->m_log_ringbuf_pos+i) % DC_LOG_RINGBUF_SIZE;
if( context->m_log_ringbuf[j] ) {
struct tm wanted_struct;
memcpy(&wanted_struct, localtime(&context->m_log_ringbuf_times[j]), sizeof(struct tm));
@ -787,7 +787,7 @@ void dc_marknoticed_chat(dc_context_t* context, uint32_t chat_id)
dc_sqlite3_lock(context->m_sql);
stmt = dc_sqlite3_predefine__(context->m_sql, UPDATE_msgs_SET_state_WHERE_chat_id_AND_state,
"UPDATE msgs SET state=" DC_STRINGIFY(MR_STATE_IN_NOTICED) " WHERE chat_id=? AND state=" DC_STRINGIFY(MR_STATE_IN_FRESH) ";");
"UPDATE msgs SET state=" DC_STRINGIFY(DC_STATE_IN_NOTICED) " WHERE chat_id=? AND state=" DC_STRINGIFY(DC_STATE_IN_FRESH) ";");
sqlite3_bind_int(stmt, 1, chat_id);
sqlite3_step(stmt);
@ -846,7 +846,7 @@ uint32_t dc_get_chat_id_by_grpid__(dc_context_t* context, const char* grpid, int
if( sqlite3_step(stmt)==SQLITE_ROW ) {
chat_id = sqlite3_column_int(stmt, 0);
if(ret_blocked) { *ret_blocked = sqlite3_column_int(stmt, 1); }
if(ret_verified) { *ret_verified = (sqlite3_column_int(stmt, 2)==MR_CHAT_TYPE_VERIFIED_GROUP); }
if(ret_verified) { *ret_verified = (sqlite3_column_int(stmt, 2)==DC_CHAT_TYPE_VERIFIED_GROUP); }
}
cleanup:
@ -894,17 +894,17 @@ uint32_t dc_create_chat_by_contact_id(dc_context_t* context, uint32_t contact_id
goto cleanup; /* success */
}
if( 0==dc_real_contact_exists__(context, contact_id) && contact_id!=MR_CONTACT_ID_SELF ) {
if( 0==dc_real_contact_exists__(context, contact_id) && contact_id!=DC_CONTACT_ID_SELF ) {
dc_log_warning(context, 0, "Cannot create chat, contact %i does not exist.", (int)contact_id);
goto cleanup;
}
dc_create_or_lookup_nchat_by_contact_id__(context, contact_id, MR_CHAT_NOT_BLOCKED, &chat_id, NULL);
dc_create_or_lookup_nchat_by_contact_id__(context, contact_id, DC_CHAT_NOT_BLOCKED, &chat_id, NULL);
if( chat_id ) {
send_event = 1;
}
dc_scaleup_contact_origin__(context, contact_id, MR_ORIGIN_CREATE_CHAT);
dc_scaleup_contact_origin__(context, contact_id, DC_ORIGIN_CREATE_CHAT);
cleanup:
if( locked ) { dc_sqlite3_unlock(context->m_sql); }
@ -962,7 +962,7 @@ uint32_t dc_create_chat_by_msg_id(dc_context_t* context, uint32_t msg_id)
if( !dc_msg_load_from_db__(msg, context, msg_id)
|| !dc_chat_load_from_db__(chat, msg->m_chat_id)
|| chat->m_id <= MR_CHAT_ID_LAST_SPECIAL ) {
|| chat->m_id <= DC_CHAT_ID_LAST_SPECIAL ) {
goto cleanup;
}
@ -973,7 +973,7 @@ uint32_t dc_create_chat_by_msg_id(dc_context_t* context, uint32_t msg_id)
send_event = 1;
}
dc_scaleup_contact_origin__(context, msg->m_from_id, MR_ORIGIN_CREATE_CHAT);
dc_scaleup_contact_origin__(context, msg->m_from_id, DC_ORIGIN_CREATE_CHAT);
cleanup:
if( locked ) { dc_sqlite3_unlock(context->m_sql); }
@ -1143,7 +1143,7 @@ dc_array_t* dc_get_chat_contacts(dc_context_t* context, uint32_t chat_id)
goto cleanup;
}
if( chat_id == MR_CHAT_ID_DEADDROP ) {
if( chat_id == DC_CHAT_ID_DEADDROP ) {
goto cleanup; /* we could also create a list for all contacts in the deaddrop by searching contacts belonging to chats with chats.blocked=2, however, currently this is not needed */
}
@ -1195,9 +1195,9 @@ dc_array_t* dc_get_fresh_msgs(dc_context_t* context)
" FROM msgs m"
" LEFT JOIN contacts ct ON m.from_id=ct.id"
" LEFT JOIN chats c ON m.chat_id=c.id"
" WHERE m.state=" DC_STRINGIFY(MR_STATE_IN_FRESH) " AND ct.blocked=0 AND (c.blocked=0 OR c.blocked=?)"
" WHERE m.state=" DC_STRINGIFY(DC_STATE_IN_FRESH) " AND ct.blocked=0 AND (c.blocked=0 OR c.blocked=?)"
" ORDER BY m.timestamp DESC,m.id DESC;"); /* the list starts with the newest messages*/
sqlite3_bind_int(stmt, 1, show_deaddrop? MR_CHAT_DEADDROP_BLOCKED : 0);
sqlite3_bind_int(stmt, 1, show_deaddrop? DC_CHAT_DEADDROP_BLOCKED : 0);
while( sqlite3_step(stmt) == SQLITE_ROW ) {
dc_array_add_id(ret, sqlite3_column_int(stmt, 0));
@ -1263,20 +1263,20 @@ dc_array_t* dc_get_chat_msgs(dc_context_t* context, uint32_t chat_id, uint32_t f
dc_sqlite3_lock(context->m_sql);
locked = 1;
if( chat_id == MR_CHAT_ID_DEADDROP )
if( chat_id == DC_CHAT_ID_DEADDROP )
{
stmt = dc_sqlite3_predefine__(context->m_sql, SELECT_i_FROM_msgs_LEFT_JOIN_chats_contacts_WHERE_blocked,
"SELECT m.id, m.timestamp"
" FROM msgs m"
" LEFT JOIN chats ON m.chat_id=chats.id"
" LEFT JOIN contacts ON m.from_id=contacts.id"
" WHERE m.from_id!=" DC_STRINGIFY(MR_CONTACT_ID_SELF)
" WHERE m.from_id!=" DC_STRINGIFY(DC_CONTACT_ID_SELF)
" AND m.hidden=0 "
" AND chats.blocked=" DC_STRINGIFY(MR_CHAT_DEADDROP_BLOCKED)
" AND chats.blocked=" DC_STRINGIFY(DC_CHAT_DEADDROP_BLOCKED)
" AND contacts.blocked=0"
" ORDER BY m.timestamp,m.id;"); /* the list starts with the oldest message*/
}
else if( chat_id == MR_CHAT_ID_STARRED )
else if( chat_id == DC_CHAT_ID_STARRED )
{
stmt = dc_sqlite3_predefine__(context->m_sql, SELECT_i_FROM_msgs_LEFT_JOIN_contacts_WHERE_starred,
"SELECT m.id, m.timestamp"
@ -1306,7 +1306,7 @@ dc_array_t* dc_get_chat_msgs(dc_context_t* context, uint32_t chat_id, uint32_t f
/* add user marker */
if( curr_id == marker1before ) {
dc_array_add_id(ret, MR_MSG_ID_MARKER1);
dc_array_add_id(ret, DC_MSG_ID_MARKER1);
}
/* add daymarker, if needed */
@ -1314,7 +1314,7 @@ dc_array_t* dc_get_chat_msgs(dc_context_t* context, uint32_t chat_id, uint32_t f
curr_local_timestamp = (time_t)sqlite3_column_int64(stmt, 1) + cnv_to_local;
curr_day = curr_local_timestamp/SECONDS_PER_DAY;
if( curr_day != last_day ) {
dc_array_add_id(ret, MR_MSG_ID_DAYMARKER);
dc_array_add_id(ret, DC_MSG_ID_DAYMARKER);
last_day = curr_day;
}
}
@ -1415,12 +1415,12 @@ dc_array_t* dc_search_msgs(dc_context_t* context, uint32_t chat_id, const char*
"SELECT m.id, m.timestamp FROM msgs m"
" LEFT JOIN contacts ct ON m.from_id=ct.id"
" LEFT JOIN chats c ON m.chat_id=c.id"
" WHERE m.chat_id>" DC_STRINGIFY(MR_CHAT_ID_LAST_SPECIAL)
" WHERE m.chat_id>" DC_STRINGIFY(DC_CHAT_ID_LAST_SPECIAL)
" AND m.hidden=0 "
" AND (c.blocked=0 OR c.blocked=?)"
" AND ct.blocked=0 AND (m.txt LIKE ? OR ct.name LIKE ?)"
" ORDER BY m.timestamp DESC,m.id DESC;"); /* chat overview starts with the newest message*/
sqlite3_bind_int (stmt, 1, show_deaddrop? MR_CHAT_DEADDROP_BLOCKED : 0);
sqlite3_bind_int (stmt, 1, show_deaddrop? DC_CHAT_DEADDROP_BLOCKED : 0);
sqlite3_bind_text(stmt, 2, strLikeInText, -1, SQLITE_STATIC);
sqlite3_bind_text(stmt, 3, strLikeBeg, -1, SQLITE_STATIC);
}
@ -1519,7 +1519,7 @@ int dc_get_fresh_msg_count__(dc_context_t* context, uint32_t chat_id)
stmt = dc_sqlite3_predefine__(context->m_sql, SELECT_COUNT_FROM_msgs_WHERE_state_AND_chat_id,
"SELECT COUNT(*) FROM msgs "
" WHERE state=" DC_STRINGIFY(MR_STATE_IN_FRESH)
" WHERE state=" DC_STRINGIFY(DC_STATE_IN_FRESH)
" AND hidden=0 "
" AND chat_id=?;"); /* we have an index over the state-column, this should be sufficient as there are typically only few fresh messages */
sqlite3_bind_int(stmt, 1, chat_id);
@ -1540,9 +1540,9 @@ uint32_t dc_get_last_deaddrop_fresh_msg__(dc_context_t* context)
"SELECT m.id "
" FROM msgs m "
" LEFT JOIN chats c ON c.id=m.chat_id "
" WHERE m.state=" DC_STRINGIFY(MR_STATE_IN_FRESH)
" WHERE m.state=" DC_STRINGIFY(DC_STATE_IN_FRESH)
" AND m.hidden=0 "
" AND c.blocked=" DC_STRINGIFY(MR_CHAT_DEADDROP_BLOCKED)
" AND c.blocked=" DC_STRINGIFY(DC_CHAT_DEADDROP_BLOCKED)
" ORDER BY m.timestamp DESC, m.id DESC;"); /* we have an index over the state-column, this should be sufficient as there are typically only few fresh messages */
if( sqlite3_step(stmt) != SQLITE_ROW ) {
@ -1578,7 +1578,7 @@ size_t dc_get_chat_cnt__(dc_context_t* context)
}
stmt = dc_sqlite3_predefine__(context->m_sql, SELECT_COUNT_FROM_chats,
"SELECT COUNT(*) FROM chats WHERE id>" DC_STRINGIFY(MR_CHAT_ID_LAST_SPECIAL) " AND blocked=0;");
"SELECT COUNT(*) FROM chats WHERE id>" DC_STRINGIFY(DC_CHAT_ID_LAST_SPECIAL) " AND blocked=0;");
if( sqlite3_step(stmt) != SQLITE_ROW ) {
return 0;
}
@ -1603,7 +1603,7 @@ void dc_lookup_real_nchat_by_contact_id__(dc_context_t* context, uint32_t contac
"SELECT c.id, c.blocked"
" FROM chats c"
" INNER JOIN chats_contacts j ON c.id=j.chat_id"
" WHERE c.type=" DC_STRINGIFY(MR_CHAT_TYPE_SINGLE) " AND c.id>" DC_STRINGIFY(MR_CHAT_ID_LAST_SPECIAL) " AND j.contact_id=?;");
" WHERE c.type=" DC_STRINGIFY(DC_CHAT_TYPE_SINGLE) " AND c.id>" DC_STRINGIFY(DC_CHAT_ID_LAST_SPECIAL) " AND j.contact_id=?;");
sqlite3_bind_int(stmt, 1, contact_id);
if( sqlite3_step(stmt) == SQLITE_ROW ) {
@ -1649,8 +1649,8 @@ void dc_create_or_lookup_nchat_by_contact_id__(dc_context_t* context, uint32_t c
chat_name = (contact->m_name&&contact->m_name[0])? contact->m_name : contact->m_addr;
/* create chat record */
q = sqlite3_mprintf("INSERT INTO chats (type, name, param, blocked) VALUES(%i, %Q, %Q, %i)", MR_CHAT_TYPE_SINGLE, chat_name,
contact_id==MR_CONTACT_ID_SELF? "K=1" : "", create_blocked);
q = sqlite3_mprintf("INSERT INTO chats (type, name, param, blocked) VALUES(%i, %Q, %Q, %i)", DC_CHAT_TYPE_SINGLE, chat_name,
contact_id==DC_CONTACT_ID_SELF? "K=1" : "", create_blocked);
assert( DC_PARAM_SELFTALK == 'K' );
stmt = dc_sqlite3_prepare_v2_(context->m_sql, q);
if( stmt == NULL) {
@ -1780,7 +1780,7 @@ int dc_get_fresh_msg_count(dc_context_t* context, uint32_t chat_id)
*/
void dc_archive_chat(dc_context_t* context, uint32_t chat_id, int archive)
{
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= MR_CHAT_ID_LAST_SPECIAL || (archive!=0 && archive!=1) ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= DC_CHAT_ID_LAST_SPECIAL || (archive!=0 && archive!=1) ) {
return;
}
@ -1839,7 +1839,7 @@ void dc_delete_chat(dc_context_t* context, uint32_t chat_id)
dc_chat_t* obj = dc_chat_new(context);
char* q3 = NULL;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= MR_CHAT_ID_LAST_SPECIAL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= DC_CHAT_ID_LAST_SPECIAL ) {
goto cleanup;
}
@ -1929,12 +1929,12 @@ static uint32_t dc_send_msg_i__(dc_context_t* context, dc_chat_t* chat, const dc
sqlite3_stmt* stmt;
uint32_t msg_id = 0, to_id = 0;
if( !MR_CHAT_TYPE_CAN_SEND(chat->m_type) ) {
if( !DC_CHAT_TYPE_CAN_SEND(chat->m_type) ) {
dc_log_error(context, 0, "Cannot send to chat type #%i.", chat->m_type);
goto cleanup;
}
if( MR_CHAT_TYPE_IS_MULTI(chat->m_type) && !dc_is_contact_in_chat__(context, chat->m_id, MR_CONTACT_ID_SELF) ) {
if( DC_CHAT_TYPE_IS_MULTI(chat->m_type) && !dc_is_contact_in_chat__(context, chat->m_id, DC_CONTACT_ID_SELF) ) {
dc_log_error(context, DC_ERROR_SELF_NOT_IN_GROUP, NULL);
goto cleanup;
}
@ -1945,11 +1945,11 @@ static uint32_t dc_send_msg_i__(dc_context_t* context, dc_chat_t* chat, const dc
dc_log_error(context, 0, "Cannot send message, not configured successfully.");
goto cleanup;
}
rfc724_mid = mr_create_outgoing_rfc724_mid(MR_CHAT_TYPE_IS_MULTI(chat->m_type)? chat->m_grpid : NULL, from);
rfc724_mid = mr_create_outgoing_rfc724_mid(DC_CHAT_TYPE_IS_MULTI(chat->m_type)? chat->m_grpid : NULL, from);
free(from);
}
if( chat->m_type == MR_CHAT_TYPE_SINGLE )
if( chat->m_type == DC_CHAT_TYPE_SINGLE )
{
stmt = dc_sqlite3_predefine__(context->m_sql, SELECT_c_FROM_chats_contacts_WHERE_c,
"SELECT contact_id FROM chats_contacts WHERE chat_id=?;");
@ -1960,7 +1960,7 @@ static uint32_t dc_send_msg_i__(dc_context_t* context, dc_chat_t* chat, const dc
}
to_id = sqlite3_column_int(stmt, 0);
}
else if( MR_CHAT_TYPE_IS_MULTI(chat->m_type) )
else if( DC_CHAT_TYPE_IS_MULTI(chat->m_type) )
{
if( dc_param_get_int(chat->m_param, DC_PARAM_UNPROMOTED, 0)==1 ) {
/* mark group as being no longer unpromoted */
@ -1980,7 +1980,7 @@ static uint32_t dc_send_msg_i__(dc_context_t* context, dc_chat_t* chat, const dc
" LEFT JOIN contacts c ON cc.contact_id=c.id "
" LEFT JOIN acpeerstates ps ON c.addr=ps.addr "
" WHERE cc.chat_id=? " /* take care that this statement returns NULL rows if there is no peerstates for a chat member! */
" AND cc.contact_id>" DC_STRINGIFY(MR_CONTACT_ID_LAST_SPECIAL) ";"); /* for DC_PARAM_SELFTALK this statement does not return any row */
" AND cc.contact_id>" DC_STRINGIFY(DC_CONTACT_ID_LAST_SPECIAL) ";"); /* for DC_PARAM_SELFTALK this statement does not return any row */
sqlite3_bind_int(stmt, 1, chat->m_id);
while( sqlite3_step(stmt) == SQLITE_ROW )
{
@ -2019,12 +2019,12 @@ static uint32_t dc_send_msg_i__(dc_context_t* context, dc_chat_t* chat, const dc
stmt = dc_sqlite3_predefine__(context->m_sql, INSERT_INTO_msgs_mcftttstpb,
"INSERT INTO msgs (rfc724_mid,chat_id,from_id,to_id, timestamp,type,state, txt,param,hidden) VALUES (?,?,?,?, ?,?,?, ?,?,?);");
sqlite3_bind_text (stmt, 1, rfc724_mid, -1, SQLITE_STATIC);
sqlite3_bind_int (stmt, 2, MR_CHAT_ID_MSGS_IN_CREATION);
sqlite3_bind_int (stmt, 3, MR_CONTACT_ID_SELF);
sqlite3_bind_int (stmt, 2, DC_CHAT_ID_MSGS_IN_CREATION);
sqlite3_bind_int (stmt, 3, DC_CONTACT_ID_SELF);
sqlite3_bind_int (stmt, 4, to_id);
sqlite3_bind_int64(stmt, 5, timestamp);
sqlite3_bind_int (stmt, 6, msg->m_type);
sqlite3_bind_int (stmt, 7, MR_STATE_OUT_PENDING);
sqlite3_bind_int (stmt, 7, DC_STATE_OUT_PENDING);
sqlite3_bind_text (stmt, 8, msg->m_text? msg->m_text : "", -1, SQLITE_STATIC);
sqlite3_bind_text (stmt, 9, msg->m_param->m_packed, -1, SQLITE_STATIC);
sqlite3_bind_int (stmt, 10, msg->m_hidden);
@ -2074,7 +2074,7 @@ uint32_t dc_send_msg_object(dc_context_t* context, uint32_t chat_id, dc_msg_t* m
int locked = 0, transaction_pending = 0;
char* pathNfilename = NULL;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || msg == NULL || chat_id <= MR_CHAT_ID_LAST_SPECIAL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || msg == NULL || chat_id <= DC_CHAT_ID_LAST_SPECIAL ) {
return 0;
}
@ -2213,7 +2213,7 @@ uint32_t dc_send_text_msg(dc_context_t* context, uint32_t chat_id, const char* t
dc_msg_t* msg = dc_msg_new();
uint32_t ret = 0;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= MR_CHAT_ID_LAST_SPECIAL || text_to_send == NULL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= DC_CHAT_ID_LAST_SPECIAL || text_to_send == NULL ) {
goto cleanup;
}
@ -2254,7 +2254,7 @@ uint32_t dc_send_image_msg(dc_context_t* context, uint32_t chat_id, const char*
dc_msg_t* msg = dc_msg_new();
uint32_t ret = 0;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= MR_CHAT_ID_LAST_SPECIAL || file == NULL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= DC_CHAT_ID_LAST_SPECIAL || file == NULL ) {
goto cleanup;
}
@ -2299,7 +2299,7 @@ uint32_t dc_send_video_msg(dc_context_t* context, uint32_t chat_id, const char*
dc_msg_t* msg = dc_msg_new();
uint32_t ret = 0;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= MR_CHAT_ID_LAST_SPECIAL || file == NULL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= DC_CHAT_ID_LAST_SPECIAL || file == NULL ) {
goto cleanup;
}
@ -2343,7 +2343,7 @@ uint32_t dc_send_voice_msg(dc_context_t* context, uint32_t chat_id, const char*
dc_msg_t* msg = dc_msg_new();
uint32_t ret = 0;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= MR_CHAT_ID_LAST_SPECIAL || file == NULL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= DC_CHAT_ID_LAST_SPECIAL || file == NULL ) {
goto cleanup;
}
@ -2386,7 +2386,7 @@ uint32_t dc_send_audio_msg(dc_context_t* context, uint32_t chat_id, const char*
dc_msg_t* msg = dc_msg_new();
uint32_t ret = 0;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= MR_CHAT_ID_LAST_SPECIAL || file == NULL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= DC_CHAT_ID_LAST_SPECIAL || file == NULL ) {
goto cleanup;
}
@ -2428,7 +2428,7 @@ uint32_t dc_send_file_msg(dc_context_t* context, uint32_t chat_id, const char* f
dc_msg_t* msg = dc_msg_new();
uint32_t ret = 0;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= MR_CHAT_ID_LAST_SPECIAL || file == NULL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= DC_CHAT_ID_LAST_SPECIAL || file == NULL ) {
goto cleanup;
}
@ -2475,7 +2475,7 @@ uint32_t dc_send_vcard_msg(dc_context_t* context, uint32_t chat_id, uint32_t con
dc_contact_t* contact = NULL;
char* text_to_send = NULL;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= MR_CHAT_ID_LAST_SPECIAL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= DC_CHAT_ID_LAST_SPECIAL ) {
goto cleanup;
}
@ -2514,11 +2514,11 @@ uint32_t dc_add_device_msg__(dc_context_t* context, uint32_t chat_id, const char
stmt = dc_sqlite3_predefine__(context->m_sql, INSERT_INTO_msgs_cftttst,
"INSERT INTO msgs (chat_id,from_id,to_id, timestamp,type,state, txt) VALUES (?,?,?, ?,?,?, ?);");
sqlite3_bind_int (stmt, 1, chat_id);
sqlite3_bind_int (stmt, 2, MR_CONTACT_ID_DEVICE);
sqlite3_bind_int (stmt, 3, MR_CONTACT_ID_DEVICE);
sqlite3_bind_int (stmt, 2, DC_CONTACT_ID_DEVICE);
sqlite3_bind_int (stmt, 3, DC_CONTACT_ID_DEVICE);
sqlite3_bind_int64(stmt, 4, timestamp);
sqlite3_bind_int (stmt, 5, MR_MSG_TEXT);
sqlite3_bind_int (stmt, 6, MR_STATE_IN_NOTICED);
sqlite3_bind_int (stmt, 6, DC_STATE_IN_NOTICED);
sqlite3_bind_text (stmt, 7, text, -1, SQLITE_STATIC);
if( sqlite3_step(stmt) != SQLITE_DONE ) {
return 0;
@ -2563,7 +2563,7 @@ cleanup:
******************************************************************************/
#define IS_SELF_IN_GROUP__ (dc_is_contact_in_chat__(context, chat_id, MR_CONTACT_ID_SELF)==1)
#define IS_SELF_IN_GROUP__ (dc_is_contact_in_chat__(context, chat_id, DC_CONTACT_ID_SELF)==1)
#define DO_SEND_STATUS_MAILS (dc_param_get_int(chat->m_param, DC_PARAM_UNPROMOTED, 0)==0)
@ -2594,14 +2594,14 @@ static int dc_real_group_exists__(dc_context_t* context, uint32_t chat_id)
int ret = 0;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || context->m_sql->m_cobj==NULL
|| chat_id <= MR_CHAT_ID_LAST_SPECIAL ) {
|| chat_id <= DC_CHAT_ID_LAST_SPECIAL ) {
return 0;
}
stmt = dc_sqlite3_predefine__(context->m_sql, SELECT_id_FROM_chats_WHERE_id,
"SELECT id FROM chats "
" WHERE id=? "
" AND (type=" DC_STRINGIFY(MR_CHAT_TYPE_GROUP) " OR type=" DC_STRINGIFY(MR_CHAT_TYPE_VERIFIED_GROUP) ");");
" AND (type=" DC_STRINGIFY(DC_CHAT_TYPE_GROUP) " OR type=" DC_STRINGIFY(DC_CHAT_TYPE_VERIFIED_GROUP) ");");
sqlite3_bind_int(stmt, 1, chat_id);
if( sqlite3_step(stmt) == SQLITE_ROW ) {
@ -2662,12 +2662,12 @@ uint32_t dc_create_group_chat(dc_context_t* context, int verified, const char* c
dc_sqlite3_lock(context->m_sql);
locked = 1;
draft_txt = mrstock_str_repl_string(MR_STR_NEWGROUPDRAFT, chat_name);
draft_txt = dc_stock_str_repl_string(DC_STR_NEWGROUPDRAFT, chat_name);
grpid = dc_create_id();
stmt = dc_sqlite3_prepare_v2_(context->m_sql,
"INSERT INTO chats (type, name, draft_timestamp, draft_txt, grpid, param) VALUES(?, ?, ?, ?, ?, 'U=1');" /*U=DC_PARAM_UNPROMOTED*/ );
sqlite3_bind_int (stmt, 1, verified? MR_CHAT_TYPE_VERIFIED_GROUP : MR_CHAT_TYPE_GROUP);
sqlite3_bind_int (stmt, 1, verified? DC_CHAT_TYPE_VERIFIED_GROUP : DC_CHAT_TYPE_GROUP);
sqlite3_bind_text (stmt, 2, chat_name, -1, SQLITE_STATIC);
sqlite3_bind_int64(stmt, 3, time(NULL));
sqlite3_bind_text (stmt, 4, draft_txt, -1, SQLITE_STATIC);
@ -2680,7 +2680,7 @@ uint32_t dc_create_group_chat(dc_context_t* context, int verified, const char* c
goto cleanup;
}
if( dc_add_to_chat_contacts_table__(context, chat_id, MR_CONTACT_ID_SELF) ) {
if( dc_add_to_chat_contacts_table__(context, chat_id, DC_CONTACT_ID_SELF) ) {
goto cleanup;
}
@ -2724,7 +2724,7 @@ int dc_set_chat_name(dc_context_t* context, uint32_t chat_id, const char* new_na
dc_msg_t* msg = dc_msg_new();
char* q3 = NULL;
if( context==NULL || context->m_magic != DC_CONTEXT_MAGIC || new_name==NULL || new_name[0]==0 || chat_id <= MR_CHAT_ID_LAST_SPECIAL ) {
if( context==NULL || context->m_magic != DC_CONTEXT_MAGIC || new_name==NULL || new_name[0]==0 || chat_id <= DC_CHAT_ID_LAST_SPECIAL ) {
goto cleanup;
}
@ -2758,7 +2758,7 @@ int dc_set_chat_name(dc_context_t* context, uint32_t chat_id, const char* new_na
if( DO_SEND_STATUS_MAILS )
{
msg->m_type = MR_MSG_TEXT;
msg->m_text = mrstock_str_repl_string2(MR_STR_MSGGRPNAME, chat->m_name, new_name);
msg->m_text = dc_stock_str_repl_string2(DC_STR_MSGGRPNAME, chat->m_name, new_name);
dc_param_set_int(msg->m_param, DC_PARAM_CMD, DC_CMD_GROUPNAME_CHANGED);
msg->m_id = dc_send_msg_object(context, chat_id, msg);
context->m_cb(context, DC_EVENT_MSGS_CHANGED, chat_id, msg->m_id);
@ -2803,7 +2803,7 @@ int dc_set_chat_profile_image(dc_context_t* context, uint32_t chat_id, const cha
dc_chat_t* chat = dc_chat_new(context);
dc_msg_t* msg = dc_msg_new();
if( context==NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= MR_CHAT_ID_LAST_SPECIAL ) {
if( context==NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= DC_CHAT_ID_LAST_SPECIAL ) {
goto cleanup;
}
@ -2834,7 +2834,7 @@ int dc_set_chat_profile_image(dc_context_t* context, uint32_t chat_id, const cha
dc_param_set_int(msg->m_param, DC_PARAM_CMD, DC_CMD_GROUPIMAGE_CHANGED);
dc_param_set (msg->m_param, DC_PARAM_CMD_ARG, new_image);
msg->m_type = MR_MSG_TEXT;
msg->m_text = mrstock_str(new_image? MR_STR_MSGGRPIMGCHANGED : MR_STR_MSGGRPIMGDELETED);
msg->m_text = dc_stock_str(new_image? DC_STR_MSGGRPIMGCHANGED : DC_STR_MSGGRPIMGDELETED);
msg->m_id = dc_send_msg_object(context, chat_id, msg);
context->m_cb(context, DC_EVENT_MSGS_CHANGED, chat_id, msg->m_id);
}
@ -2889,7 +2889,7 @@ int dc_is_contact_in_chat__(dc_context_t* context, uint32_t chat_id, uint32_t co
int dc_is_contact_in_chat(dc_context_t* context, uint32_t chat_id, uint32_t contact_id)
{
/* this function works for group and for normal chats, however, it is more useful for group chats.
MR_CONTACT_ID_SELF may be used to check, if the user itself is in a group chat (MR_CONTACT_ID_SELF is not added to normal chats) */
DC_CONTACT_ID_SELF may be used to check, if the user itself is in a group chat (DC_CONTACT_ID_SELF is not added to normal chats) */
int ret = 0;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC ) {
@ -2915,7 +2915,7 @@ int dc_add_contact_to_chat_ex(dc_context_t* context, uint32_t chat_id, uint32_t
dc_msg_t* msg = dc_msg_new();
char* self_addr = NULL;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || contact == NULL || chat_id <= MR_CHAT_ID_LAST_SPECIAL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || contact == NULL || chat_id <= DC_CHAT_ID_LAST_SPECIAL ) {
goto cleanup;
}
@ -2923,7 +2923,7 @@ int dc_add_contact_to_chat_ex(dc_context_t* context, uint32_t chat_id, uint32_t
locked = 1;
if( 0==dc_real_group_exists__(context, chat_id) /*this also makes sure, not contacts are added to special or normal chats*/
|| (0==dc_real_contact_exists__(context, contact_id) && contact_id!=MR_CONTACT_ID_SELF)
|| (0==dc_real_contact_exists__(context, contact_id) && contact_id!=DC_CONTACT_ID_SELF)
|| 0==dc_chat_load_from_db__(chat, chat_id) ) {
goto cleanup;
}
@ -2941,7 +2941,7 @@ int dc_add_contact_to_chat_ex(dc_context_t* context, uint32_t chat_id, uint32_t
self_addr = dc_sqlite3_get_config__(context->m_sql, "configured_addr", "");
if( strcasecmp(contact->m_addr, self_addr)==0 ) {
goto cleanup; /* ourself is added using MR_CONTACT_ID_SELF, do not add it explicitly. if SELF is not in the group, members cannot be added at all. */
goto cleanup; /* ourself is added using DC_CONTACT_ID_SELF, do not add it explicitly. if SELF is not in the group, members cannot be added at all. */
}
if( dc_is_contact_in_chat__(context, chat_id, contact_id) )
@ -2954,7 +2954,7 @@ int dc_add_contact_to_chat_ex(dc_context_t* context, uint32_t chat_id, uint32_t
}
else
{
if( chat->m_type == MR_CHAT_TYPE_VERIFIED_GROUP )
if( chat->m_type == DC_CHAT_TYPE_VERIFIED_GROUP )
{
if( !dc_apeerstate_load_by_addr__(peerstate, context->m_sql, contact->m_addr)
|| dc_contact_is_verified__(contact, peerstate) != DC_BIDIRECT_VERIFIED ) {
@ -2975,7 +2975,7 @@ int dc_add_contact_to_chat_ex(dc_context_t* context, uint32_t chat_id, uint32_t
if( DO_SEND_STATUS_MAILS )
{
msg->m_type = MR_MSG_TEXT;
msg->m_text = mrstock_str_repl_string(MR_STR_MSGADDMEMBER, (contact->m_authname&&contact->m_authname[0])? contact->m_authname : contact->m_addr);
msg->m_text = dc_stock_str_repl_string(DC_STR_MSGADDMEMBER, (contact->m_authname&&contact->m_authname[0])? contact->m_authname : contact->m_addr);
dc_param_set_int(msg->m_param, DC_PARAM_CMD, DC_CMD_MEMBER_ADDED_TO_GROUP);
dc_param_set (msg->m_param, DC_PARAM_CMD_ARG ,contact->m_addr);
dc_param_set_int(msg->m_param, DC_PARAM_CMD_ARG2,flags); // combine the Secure-Join protocol headers with the Chat-Group-Member-Added header
@ -3017,7 +3017,7 @@ cleanup:
*
* @return 1=member added to group, 0=error
*/
int dc_add_contact_to_chat(dc_context_t* context, uint32_t chat_id, uint32_t contact_id /*may be MR_CONTACT_ID_SELF*/)
int dc_add_contact_to_chat(dc_context_t* context, uint32_t chat_id, uint32_t contact_id /*may be DC_CONTACT_ID_SELF*/)
{
return dc_add_contact_to_chat_ex(context, chat_id, contact_id, 0);
}
@ -3041,7 +3041,7 @@ int dc_add_contact_to_chat(dc_context_t* context, uint32_t chat_id, uint32_t con
*
* @return 1=member removed from group, 0=error
*/
int dc_remove_contact_from_chat(dc_context_t* context, uint32_t chat_id, uint32_t contact_id /*may be MR_CONTACT_ID_SELF*/)
int dc_remove_contact_from_chat(dc_context_t* context, uint32_t chat_id, uint32_t contact_id /*may be DC_CONTACT_ID_SELF*/)
{
int success = 0, locked = 0;
dc_contact_t* contact = dc_get_contact(context, contact_id);
@ -3049,7 +3049,7 @@ int dc_remove_contact_from_chat(dc_context_t* context, uint32_t chat_id, uint32_
dc_msg_t* msg = dc_msg_new();
char* q3 = NULL;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= MR_CHAT_ID_LAST_SPECIAL || (contact_id<=MR_CONTACT_ID_LAST_SPECIAL && contact_id!=MR_CONTACT_ID_SELF) ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || chat_id <= DC_CHAT_ID_LAST_SPECIAL || (contact_id<=DC_CONTACT_ID_LAST_SPECIAL && contact_id!=DC_CONTACT_ID_SELF) ) {
goto cleanup; /* we do not check if "contact_id" exists but just delete all records with the id from chats_contacts */
} /* this allows to delete pending references to deleted contacts. Of course, this should _not_ happen. */
@ -3076,12 +3076,12 @@ int dc_remove_contact_from_chat(dc_context_t* context, uint32_t chat_id, uint32_
if( DO_SEND_STATUS_MAILS )
{
msg->m_type = MR_MSG_TEXT;
if( contact->m_id == MR_CONTACT_ID_SELF ) {
if( contact->m_id == DC_CONTACT_ID_SELF ) {
dc_set_group_explicitly_left__(context, chat->m_grpid);
msg->m_text = mrstock_str(MR_STR_MSGGROUPLEFT);
msg->m_text = dc_stock_str(DC_STR_MSGGROUPLEFT);
}
else {
msg->m_text = mrstock_str_repl_string(MR_STR_MSGDELMEMBER, (contact->m_authname&&contact->m_authname[0])? contact->m_authname : contact->m_addr);
msg->m_text = dc_stock_str_repl_string(DC_STR_MSGDELMEMBER, (contact->m_authname&&contact->m_authname[0])? contact->m_authname : contact->m_addr);
}
dc_param_set_int(msg->m_param, DC_PARAM_CMD, DC_CMD_MEMBER_REMOVED_FROM_GROUP);
dc_param_set (msg->m_param, DC_PARAM_CMD_ARG, contact->m_addr);
@ -3126,7 +3126,7 @@ int dc_real_contact_exists__(dc_context_t* context, uint32_t contact_id)
int ret = 0;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || context->m_sql->m_cobj==NULL
|| contact_id <= MR_CONTACT_ID_LAST_SPECIAL ) {
|| contact_id <= DC_CONTACT_ID_LAST_SPECIAL ) {
return 0;
}
@ -3151,7 +3151,7 @@ size_t dc_get_real_contact_cnt__(dc_context_t* context)
}
stmt = dc_sqlite3_predefine__(context->m_sql, SELECT_COUNT_FROM_contacts, "SELECT COUNT(*) FROM contacts WHERE id>?;");
sqlite3_bind_int(stmt, 1, MR_CONTACT_ID_LAST_SPECIAL);
sqlite3_bind_int(stmt, 1, DC_CONTACT_ID_LAST_SPECIAL);
if( sqlite3_step(stmt) != SQLITE_ROW ) {
return 0;
}
@ -3219,7 +3219,7 @@ uint32_t dc_add_or_lookup_contact__( dc_context_t* context,
update_name = 1;
}
if( origin == MR_ORIGIN_INCOMING_UNKNOWN_FROM && strcmp(name, row_authname)!=0 ) {
if( origin == DC_ORIGIN_INCOMING_UNKNOWN_FROM && strcmp(name, row_authname)!=0 ) {
update_authname = 1;
}
}
@ -3246,7 +3246,7 @@ uint32_t dc_add_or_lookup_contact__( dc_context_t* context,
stmt = dc_sqlite3_predefine__(context->m_sql, UPDATE_chats_SET_n_WHERE_c,
"UPDATE chats SET name=? WHERE type=? AND id IN(SELECT chat_id FROM chats_contacts WHERE contact_id=?);");
sqlite3_bind_text(stmt, 1, name, -1, SQLITE_STATIC);
sqlite3_bind_int (stmt, 2, MR_CHAT_TYPE_SINGLE);
sqlite3_bind_int (stmt, 2, DC_CHAT_TYPE_SINGLE);
sqlite3_bind_int (stmt, 3, row_id);
sqlite3_step (stmt);
}
@ -3370,7 +3370,7 @@ uint32_t dc_create_contact(dc_context_t* context, const char* name, const char*
dc_sqlite3_lock(context->m_sql);
contact_id = dc_add_or_lookup_contact__(context, name, addr, MR_ORIGIN_MANUALLY_CREATED, &sth_modified);
contact_id = dc_add_or_lookup_contact__(context, name, addr, DC_ORIGIN_MANUALLY_CREATED, &sth_modified);
blocked = dc_is_contact_blocked__(context, contact_id);
@ -3432,7 +3432,7 @@ int dc_add_address_book(dc_context_t* context, const char* adr_book) /* format:
char* name = (char*)carray_get(lines, i);
char* addr = (char*)carray_get(lines, i+1);
mr_normalize_name(name);
dc_add_or_lookup_contact__(context, name, addr, MR_ORIGIN_ADRESS_BOOK, &sth_modified);
dc_add_or_lookup_contact__(context, name, addr, DC_ORIGIN_ADRESS_BOOK, &sth_modified);
if( sth_modified ) {
modify_cnt++;
}
@ -3486,7 +3486,7 @@ dc_array_t* dc_get_contacts(dc_context_t* context, uint32_t listflags, const cha
dc_sqlite3_lock(context->m_sql);
locked = 1;
self_addr = dc_sqlite3_get_config__(context->m_sql, "configured_addr", ""); /* we add MR_CONTACT_ID_SELF explicitly; so avoid doubles if the address is present as a normal entry for some case */
self_addr = dc_sqlite3_get_config__(context->m_sql, "configured_addr", ""); /* we add DC_CONTACT_ID_SELF explicitly; so avoid doubles if the address is present as a normal entry for some case */
if( (listflags&MR_GCL_VERIFIED_ONLY) || query )
{
@ -3496,7 +3496,7 @@ dc_array_t* dc_get_contacts(dc_context_t* context, uint32_t listflags, const cha
stmt = dc_sqlite3_predefine__(context->m_sql, SELECT_id_FROM_contacts_WHERE_query_ORDER_BY,
"SELECT c.id FROM contacts c"
" LEFT JOIN acpeerstates ps ON c.addr=ps.addr "
" WHERE c.addr!=? AND c.id>" DC_STRINGIFY(MR_CONTACT_ID_LAST_SPECIAL) " AND c.origin>=" DC_STRINGIFY(MR_ORIGIN_MIN_CONTACT_LIST) " AND c.blocked=0 AND (c.name LIKE ? OR c.addr LIKE ?)" /* see comments in dc_search_msgs() about the LIKE operator */
" WHERE c.addr!=? AND c.id>" DC_STRINGIFY(DC_CONTACT_ID_LAST_SPECIAL) " AND c.origin>=" DC_STRINGIFY(DC_ORIGIN_MIN_CONTACT_LIST) " AND c.blocked=0 AND (c.name LIKE ? OR c.addr LIKE ?)" /* see comments in dc_search_msgs() about the LIKE operator */
" AND (1=? OR LENGTH(ps.verified_key_fingerprint)!=0) "
" ORDER BY LOWER(c.name||c.addr),c.id;");
sqlite3_bind_text(stmt, 1, self_addr, -1, SQLITE_STATIC);
@ -3505,7 +3505,7 @@ dc_array_t* dc_get_contacts(dc_context_t* context, uint32_t listflags, const cha
sqlite3_bind_int (stmt, 4, (listflags&MR_GCL_VERIFIED_ONLY)? 0/*force checking for verified_key*/ : 1/*force statement being always true*/);
self_name = dc_sqlite3_get_config__(context->m_sql, "displayname", "");
self_name2 = mrstock_str(MR_STR_SELF);
self_name2 = dc_stock_str(DC_STR_SELF);
if( query==NULL || mr_str_contains(self_addr, query) || mr_str_contains(self_name, query) || mr_str_contains(self_name2, query) ) {
add_self = 1;
}
@ -3514,7 +3514,7 @@ dc_array_t* dc_get_contacts(dc_context_t* context, uint32_t listflags, const cha
{
stmt = dc_sqlite3_predefine__(context->m_sql, SELECT_id_FROM_contacts_ORDER_BY,
"SELECT id FROM contacts"
" WHERE addr!=? AND id>" DC_STRINGIFY(MR_CONTACT_ID_LAST_SPECIAL) " AND origin>=" DC_STRINGIFY(MR_ORIGIN_MIN_CONTACT_LIST) " AND blocked=0"
" WHERE addr!=? AND id>" DC_STRINGIFY(DC_CONTACT_ID_LAST_SPECIAL) " AND origin>=" DC_STRINGIFY(DC_ORIGIN_MIN_CONTACT_LIST) " AND blocked=0"
" ORDER BY LOWER(name||addr),id;");
sqlite3_bind_text(stmt, 1, self_addr, -1, SQLITE_STATIC);
@ -3530,7 +3530,7 @@ dc_array_t* dc_get_contacts(dc_context_t* context, uint32_t listflags, const cha
/* to the end of the list, add self - this is to be in sync with member lists and to allow the user to start a self talk */
if( (listflags&MR_GCL_ADD_SELF) && add_self ) {
dc_array_add_id(ret, MR_CONTACT_ID_SELF);
dc_array_add_id(ret, DC_CONTACT_ID_SELF);
}
cleanup:
@ -3568,7 +3568,7 @@ dc_array_t* dc_get_blocked_contacts(dc_context_t* context)
"SELECT id FROM contacts"
" WHERE id>? AND blocked!=0"
" ORDER BY LOWER(name||addr),id;");
sqlite3_bind_int(stmt, 1, MR_CONTACT_ID_LAST_SPECIAL);
sqlite3_bind_int(stmt, 1, DC_CONTACT_ID_LAST_SPECIAL);
while( sqlite3_step(stmt) == SQLITE_ROW ) {
dc_array_add_id(ret, sqlite3_column_int(stmt, 0));
}
@ -3602,7 +3602,7 @@ int dc_get_blocked_count(dc_context_t* context)
stmt = dc_sqlite3_predefine__(context->m_sql, SELECT_COUNT_FROM_contacts_WHERE_blocked,
"SELECT COUNT(*) FROM contacts"
" WHERE id>? AND blocked!=0");
sqlite3_bind_int(stmt, 1, MR_CONTACT_ID_LAST_SPECIAL);
sqlite3_bind_int(stmt, 1, DC_CONTACT_ID_LAST_SPECIAL);
if( sqlite3_step(stmt) != SQLITE_ROW ) {
goto cleanup;
}
@ -3653,7 +3653,7 @@ dc_contact_t* dc_get_contact(dc_context_t* context, uint32_t contact_id)
static void marknoticed_contact__(dc_context_t* context, uint32_t contact_id)
{
sqlite3_stmt* stmt = dc_sqlite3_predefine__(context->m_sql, UPDATE_msgs_SET_state_WHERE_from_id_AND_state,
"UPDATE msgs SET state=" DC_STRINGIFY(MR_STATE_IN_NOTICED) " WHERE from_id=? AND state=" DC_STRINGIFY(MR_STATE_IN_FRESH) ";");
"UPDATE msgs SET state=" DC_STRINGIFY(DC_STATE_IN_NOTICED) " WHERE from_id=? AND state=" DC_STRINGIFY(DC_STATE_IN_FRESH) ";");
sqlite3_bind_int(stmt, 1, contact_id);
sqlite3_step(stmt);
}
@ -3703,7 +3703,7 @@ void dc_block_chat__(dc_context_t* context, uint32_t chat_id, int new_blocking)
void dc_unblock_chat__(dc_context_t* context, uint32_t chat_id)
{
dc_block_chat__(context, chat_id, MR_CHAT_NOT_BLOCKED);
dc_block_chat__(context, chat_id, DC_CHAT_NOT_BLOCKED);
}
@ -3728,7 +3728,7 @@ void dc_block_contact(dc_context_t* context, uint32_t contact_id, int new_blocki
dc_contact_t* contact = dc_contact_new(context);
sqlite3_stmt* stmt;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || contact_id <= MR_CONTACT_ID_LAST_SPECIAL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || contact_id <= DC_CONTACT_ID_LAST_SPECIAL ) {
goto cleanup;
}
@ -3756,7 +3756,7 @@ void dc_block_contact(dc_context_t* context, uint32_t contact_id, int new_blocki
stmt = dc_sqlite3_predefine__(context->m_sql, UPDATE_chats_SET_blocked_WHERE_contact_id,
"UPDATE chats SET blocked=? WHERE type=? AND id IN (SELECT chat_id FROM chats_contacts WHERE contact_id=?);");
sqlite3_bind_int(stmt, 1, new_blocking);
sqlite3_bind_int(stmt, 2, MR_CHAT_TYPE_SINGLE);
sqlite3_bind_int(stmt, 2, DC_CHAT_TYPE_SINGLE);
sqlite3_bind_int(stmt, 3, contact_id);
if( sqlite3_step(stmt)!=SQLITE_DONE ) {
goto cleanup;
@ -3854,7 +3854,7 @@ char* dc_get_contact_encrinfo(dc_context_t* context, uint32_t contact_id)
if( dc_apeerstate_peek_key(peerstate, DC_NOT_VERIFIED) )
{
// E2E available :)
p = mrstock_str(peerstate->m_prefer_encrypt == DC_PE_MUTUAL? MR_STR_E2E_PREFERRED : MR_STR_E2E_AVAILABLE); dc_strbuilder_cat(&ret, p); free(p);
p = dc_stock_str(peerstate->m_prefer_encrypt == DC_PE_MUTUAL? DC_STR_E2E_PREFERRED : DC_STR_E2E_AVAILABLE); dc_strbuilder_cat(&ret, p); free(p);
if( self_key->m_binary == NULL ) {
dc_pgp_rand_seed(context, peerstate->m_addr, strlen(peerstate->m_addr) /*just some random data*/);
@ -3867,7 +3867,7 @@ char* dc_get_contact_encrinfo(dc_context_t* context, uint32_t contact_id)
}
dc_strbuilder_cat(&ret, " ");
p = mrstock_str(MR_STR_FINGERPRINTS); dc_strbuilder_cat(&ret, p); free(p);
p = dc_stock_str(DC_STR_FINGERPRINTS); dc_strbuilder_cat(&ret, p); free(p);
dc_strbuilder_cat(&ret, ":");
fingerprint_self = dc_key_get_formatted_fingerprint(self_key);
@ -3889,11 +3889,11 @@ char* dc_get_contact_encrinfo(dc_context_t* context, uint32_t contact_id)
if( !(loginparam->m_server_flags&MR_IMAP_SOCKET_PLAIN)
&& !(loginparam->m_server_flags&MR_SMTP_SOCKET_PLAIN) )
{
p = mrstock_str(MR_STR_ENCR_TRANSP); dc_strbuilder_cat(&ret, p); free(p);
p = dc_stock_str(DC_STR_ENCR_TRANSP); dc_strbuilder_cat(&ret, p); free(p);
}
else
{
p = mrstock_str(MR_STR_ENCR_NONE); dc_strbuilder_cat(&ret, p); free(p);
p = dc_stock_str(DC_STR_ENCR_NONE); dc_strbuilder_cat(&ret, p); free(p);
}
}
@ -3929,7 +3929,7 @@ int dc_delete_contact(dc_context_t* context, uint32_t contact_id)
int locked = 0, success = 0;
sqlite3_stmt* stmt;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || contact_id <= MR_CONTACT_ID_LAST_SPECIAL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || contact_id <= DC_CONTACT_ID_LAST_SPECIAL ) {
goto cleanup;
}
@ -4026,8 +4026,8 @@ size_t dc_get_real_msg_cnt__(dc_context_t* context)
"SELECT COUNT(*) "
" FROM msgs m "
" LEFT JOIN chats c ON c.id=m.chat_id "
" WHERE m.id>" DC_STRINGIFY(MR_MSG_ID_LAST_SPECIAL)
" AND m.chat_id>" DC_STRINGIFY(MR_CHAT_ID_LAST_SPECIAL)
" WHERE m.id>" DC_STRINGIFY(DC_MSG_ID_LAST_SPECIAL)
" AND m.chat_id>" DC_STRINGIFY(DC_CHAT_ID_LAST_SPECIAL)
" AND c.blocked=0;");
if( sqlite3_step(stmt) != SQLITE_ROW ) {
dc_sqlite3_log_error(context->m_sql, "mr_get_assigned_msg_cnt_() failed.");
@ -4214,13 +4214,13 @@ char* dc_get_msg_info(dc_context_t* context, uint32_t msg_id)
p = dc_timestamp_to_str(dc_msg_get_timestamp(msg)); dc_strbuilder_cat(&ret, p); free(p);
dc_strbuilder_cat(&ret, "\n");
if( msg->m_from_id != MR_CONTACT_ID_SELF ) {
if( msg->m_from_id != DC_CONTACT_ID_SELF ) {
dc_strbuilder_cat(&ret, "Received: ");
p = dc_timestamp_to_str(msg->m_timestamp_rcvd? msg->m_timestamp_rcvd : msg->m_timestamp); dc_strbuilder_cat(&ret, p); free(p);
dc_strbuilder_cat(&ret, "\n");
}
if( msg->m_from_id == MR_CONTACT_ID_DEVICE || msg->m_to_id == MR_CONTACT_ID_DEVICE ) {
if( msg->m_from_id == DC_CONTACT_ID_DEVICE || msg->m_to_id == DC_CONTACT_ID_DEVICE ) {
goto cleanup; // device-internal message, no further details needed
}
@ -4247,13 +4247,13 @@ char* dc_get_msg_info(dc_context_t* context, uint32_t msg_id)
/* add state */
p = NULL;
switch( msg->m_state ) {
case MR_STATE_IN_FRESH: p = safe_strdup("Fresh"); break;
case MR_STATE_IN_NOTICED: p = safe_strdup("Noticed"); break;
case MR_STATE_IN_SEEN: p = safe_strdup("Seen"); break;
case MR_STATE_OUT_DELIVERED: p = safe_strdup("Delivered"); break;
case MR_STATE_OUT_ERROR: p = safe_strdup("Error"); break;
case MR_STATE_OUT_MDN_RCVD: p = safe_strdup("Read"); break;
case MR_STATE_OUT_PENDING: p = safe_strdup("Pending"); break;
case DC_STATE_IN_FRESH: p = safe_strdup("Fresh"); break;
case DC_STATE_IN_NOTICED: p = safe_strdup("Noticed"); break;
case DC_STATE_IN_SEEN: p = safe_strdup("Seen"); break;
case DC_STATE_OUT_DELIVERED: p = safe_strdup("Delivered"); break;
case DC_STATE_OUT_ERROR: p = safe_strdup("Error"); break;
case DC_STATE_OUT_MDN_RCVD: p = safe_strdup("Read"); break;
case DC_STATE_OUT_PENDING: p = safe_strdup("Pending"); break;
default: p = dc_mprintf("%i", msg->m_state); break;
}
dc_strbuilder_catf(&ret, "State: %s", p);
@ -4373,7 +4373,7 @@ void dc_forward_msgs(dc_context_t* context, const uint32_t* msg_ids, int msg_cnt
sqlite3_stmt* stmt = NULL;
time_t curr_timestamp;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || msg_ids==NULL || msg_cnt <= 0 || chat_id <= MR_CHAT_ID_LAST_SPECIAL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || msg_ids==NULL || msg_cnt <= 0 || chat_id <= DC_CHAT_ID_LAST_SPECIAL ) {
goto cleanup;
}
@ -4507,7 +4507,7 @@ void dc_delete_msgs(dc_context_t* context, const uint32_t* msg_ids, int msg_cnt)
for( i = 0; i < msg_cnt; i++ )
{
dc_update_msg_chat_id__(context, msg_ids[i], MR_CHAT_ID_TRASH);
dc_update_msg_chat_id__(context, msg_ids[i], DC_CHAT_ID_TRASH);
dc_job_add(context, DC_JOB_DELETE_MSG_ON_IMAP, msg_ids[i], NULL, 0);
}
@ -4558,7 +4558,7 @@ void dc_markseen_msgs(dc_context_t* context, const uint32_t* msg_ids, int msg_cn
"SELECT m.state, c.blocked "
" FROM msgs m "
" LEFT JOIN chats c ON c.id=m.chat_id "
" WHERE m.id=? AND m.chat_id>" DC_STRINGIFY(MR_CHAT_ID_LAST_SPECIAL));
" WHERE m.id=? AND m.chat_id>" DC_STRINGIFY(DC_CHAT_ID_LAST_SPECIAL));
sqlite3_bind_int(stmt, 1, msg_ids[i]);
if( sqlite3_step(stmt) != SQLITE_ROW ) {
goto cleanup;
@ -4567,8 +4567,8 @@ void dc_markseen_msgs(dc_context_t* context, const uint32_t* msg_ids, int msg_cn
curr_blocked = sqlite3_column_int(stmt, 1);
if( curr_blocked == 0 )
{
if( curr_state == MR_STATE_IN_FRESH || curr_state == MR_STATE_IN_NOTICED ) {
dc_update_msg_state__(context, msg_ids[i], MR_STATE_IN_SEEN);
if( curr_state == DC_STATE_IN_FRESH || curr_state == DC_STATE_IN_NOTICED ) {
dc_update_msg_state__(context, msg_ids[i], DC_STATE_IN_SEEN);
dc_log_info(context, 0, "Seen message #%i.", msg_ids[i]);
dc_job_add(context, DC_JOB_MARKSEEN_MSG_ON_IMAP, msg_ids[i], NULL, 0); /* results in a call to dc_markseen_msg_on_imap() */
send_event = 1;
@ -4577,8 +4577,8 @@ void dc_markseen_msgs(dc_context_t* context, const uint32_t* msg_ids, int msg_cn
else
{
/* message may be in contact requests, mark as NOTICED, this does not force IMAP updated nor send MDNs */
if( curr_state == MR_STATE_IN_FRESH ) {
dc_update_msg_state__(context, msg_ids[i], MR_STATE_IN_NOTICED);
if( curr_state == DC_STATE_IN_FRESH ) {
dc_update_msg_state__(context, msg_ids[i], DC_STATE_IN_NOTICED);
send_event = 1;
}
}
@ -4604,7 +4604,7 @@ int dc_mdn_from_ext__(dc_context_t* context, uint32_t from_id, const char* rfc72
uint32_t* ret_chat_id,
uint32_t* ret_msg_id)
{
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || from_id <= MR_CONTACT_ID_LAST_SPECIAL || rfc724_mid == NULL || ret_chat_id==NULL || ret_msg_id==NULL
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || from_id <= DC_CONTACT_ID_LAST_SPECIAL || rfc724_mid == NULL || ret_chat_id==NULL || ret_msg_id==NULL
|| *ret_chat_id != 0 || *ret_msg_id != 0 ) {
return 0;
}
@ -4624,7 +4624,7 @@ int dc_mdn_from_ext__(dc_context_t* context, uint32_t from_id, const char* rfc72
int chat_type = sqlite3_column_int(stmt, 2);
int msg_state = sqlite3_column_int(stmt, 3);
if( msg_state!=MR_STATE_OUT_PENDING && msg_state!=MR_STATE_OUT_DELIVERED ) {
if( msg_state!=DC_STATE_OUT_PENDING && msg_state!=DC_STATE_OUT_DELIVERED ) {
return 0; /* eg. already marked as MDNS_RCVD. however, it is importent, that the message ID is set above as this will allow the caller eg. to move the message away */
}
@ -4643,8 +4643,8 @@ int dc_mdn_from_ext__(dc_context_t* context, uint32_t from_id, const char* rfc72
}
// Normal chat? that's quite easy.
if( chat_type == MR_CHAT_TYPE_SINGLE ) {
dc_update_msg_state__(context, *ret_msg_id, MR_STATE_OUT_MDN_RCVD);
if( chat_type == DC_CHAT_TYPE_SINGLE ) {
dc_update_msg_state__(context, *ret_msg_id, DC_STATE_OUT_MDN_RCVD);
return 1; /* send event about new state */
}
@ -4675,6 +4675,6 @@ int dc_mdn_from_ext__(dc_context_t* context, uint32_t from_id, const char* rfc72
}
/* got enough receipts :-) */
dc_update_msg_state__(context, *ret_msg_id, MR_STATE_OUT_MDN_RCVD);
dc_update_msg_state__(context, *ret_msg_id, DC_STATE_OUT_MDN_RCVD);
return 1;
}

View file

@ -68,13 +68,13 @@ struct _dc_context
char* m_dbfile; /**< The database file. This is the file given to dc_context_new(). */
char* m_blobdir; /**< Full path of the blob directory. This is the directory given to dc_context_new() or a directory in the same directory as dc_context_t::m_dbfile. */
dc_sqlite3_t* m_sql; /**< Internal SQL object, never NULL */
dc_sqlite3_t* m_sql; /**< Internal SQL object, never NULL */
dc_imap_t* m_imap; /**< Internal IMAP object, never NULL */
dc_imap_t* m_imap; /**< Internal IMAP object, never NULL */
pthread_mutex_t m_imapidle_condmutex;
int m_perform_imap_jobs_needed;
dc_smtp_t* m_smtp; /**< Internal SMTP object, never NULL */
dc_smtp_t* m_smtp; /**< Internal SMTP object, never NULL */
pthread_cond_t m_smtpidle_cond;
pthread_mutex_t m_smtpidle_condmutex;
int m_smtpidle_condflag;
@ -92,11 +92,11 @@ struct _dc_context
int m_e2ee_enabled; /**< Internal */
#define MR_LOG_RINGBUF_SIZE 200
#define DC_LOG_RINGBUF_SIZE 200
pthread_mutex_t m_log_ringbuf_critical; /**< Internal */
char* m_log_ringbuf[MR_LOG_RINGBUF_SIZE];
char* m_log_ringbuf[DC_LOG_RINGBUF_SIZE];
/**< Internal */
time_t m_log_ringbuf_times[MR_LOG_RINGBUF_SIZE];
time_t m_log_ringbuf_times[DC_LOG_RINGBUF_SIZE];
/**< Internal */
int m_log_ringbuf_pos; /**< Internal. The oldest position resp. the position that is overwritten next */
@ -166,7 +166,7 @@ typedef struct dc_e2ee_helper_t {
void* m_cdata_to_free;
// decryption
int m_encrypted; // encrypted without problems
int m_encrypted; // encrypted without problems
dc_hash_t* m_signatures; // fingerprints of valid signatures
dc_hash_t* m_gossipped_addr;

View file

@ -459,7 +459,7 @@ void dc_e2ee_encrypt(dc_context_t* mailbox, const clist* recipients_addr,
}
}
char* e = mrstock_str(MR_STR_ENCRYPTEDMSG); char* subject_str = dc_mprintf(MR_CHAT_PREFIX " %s", e); free(e);
char* e = dc_stock_str(DC_STR_ENCRYPTEDMSG); char* subject_str = dc_mprintf(DC_CHAT_PREFIX " %s", e); free(e);
struct mailimf_subject* subject = mailimf_subject_new(dc_encode_header_words(subject_str));
mailimf_fields_add(imffields_unprotected, 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));
free(subject_str);

View file

@ -320,11 +320,11 @@ static int init_chat_folders__(dc_imap_t* ths)
//as a fallback, the chats_folder is created under INBOX as required e.g. for DomainFactory
char fallback_folder[64];
snprintf(fallback_folder, sizeof(fallback_folder), "INBOX%c%s", ths->m_imap_delimiter, MR_CHATS_FOLDER);
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);
if( strcmp(folder->m_name_utf8, MR_CHATS_FOLDER)==0 || strcmp(folder->m_name_utf8, fallback_folder)==0 ) {
if( strcmp(folder->m_name_utf8, DC_CHATS_FOLDER)==0 || strcmp(folder->m_name_utf8, fallback_folder)==0 ) {
chats_folder = safe_strdup(folder->m_name_to_select);
break;
}
@ -337,8 +337,8 @@ static int init_chat_folders__(dc_imap_t* ths)
}
if( chats_folder == NULL && (ths->m_server_flags&MR_NO_MOVE_TO_CHATS)==0 ) {
dc_log_info(ths->m_context, 0, "Creating IMAP-folder \"%s\"...", MR_CHATS_FOLDER);
int r = mailimap_create(ths->m_hEtpan, MR_CHATS_FOLDER);
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) ) {
dc_log_warning(ths->m_context, 0, "Cannot create IMAP-folder, using trying INBOX subfolder.");
r = mailimap_create(ths->m_hEtpan, fallback_folder);
@ -352,7 +352,7 @@ static int init_chat_folders__(dc_imap_t* ths)
}
}
else {
chats_folder = safe_strdup(MR_CHATS_FOLDER);
chats_folder = safe_strdup(DC_CHATS_FOLDER);
dc_log_info(ths->m_context, 0, "IMAP-folder created.");
}
}

View file

@ -67,8 +67,8 @@ typedef struct dc_imap_t
int m_can_idle;
int m_has_xlist;
char* m_moveto_folder;// Folder, where reveived chat messages should go to. Normally MR_CHATS_FOLDER, may be NULL to leave them in the INBOX
char* m_sent_folder; // Folder, where send messages should go to. Normally MR_CHATS_FOLDER.
char* m_moveto_folder;// Folder, where reveived chat messages should go to. Normally DC_CHATS_FOLDER, may be NULL to leave them in the INBOX
char* m_sent_folder; // Folder, where send messages should go to. Normally DC_CHATS_FOLDER.
char m_imap_delimiter;/* IMAP Path separator. Set as a side-effect in list_folders__ */
pthread_cond_t m_watch_cond;

View file

@ -245,8 +245,8 @@ char* dc_render_setup_file(dc_context_t* context, const char* passphrase)
/* wrap HTML-commands with instructions around the encrypted payload */
{
char* setup_message_title = mrstock_str(MR_STR_AC_SETUP_MSG_SUBJECT);
char* setup_message_body = mrstock_str(MR_STR_AC_SETUP_MSG_BODY);
char* setup_message_title = dc_stock_str(DC_STR_AC_SETUP_MSG_SUBJECT);
char* setup_message_body = dc_stock_str(DC_STR_AC_SETUP_MSG_BODY);
dc_str_replace(&setup_message_body, "\r", NULL);
dc_str_replace(&setup_message_body, "\n", "<br>");
@ -502,7 +502,7 @@ char* dc_initiate_key_transfer(dc_context_t* context)
goto cleanup;
}
if( (chat_id=dc_create_chat_by_contact_id(context, MR_CONTACT_ID_SELF))==0 ) {
if( (chat_id=dc_create_chat_by_contact_id(context, DC_CONTACT_ID_SELF))==0 ) {
goto cleanup;
}
@ -657,7 +657,7 @@ int dc_continue_key_transfer(dc_context_t* context, uint32_t msg_id, const char*
char* armored_key = NULL;
char* norm_sc = NULL;
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || msg_id <= MR_MSG_ID_LAST_SPECIAL || setup_code == NULL ) {
if( context == NULL || context->m_magic != DC_CONTEXT_MAGIC || msg_id <= DC_MSG_ID_LAST_SPECIAL || setup_code == NULL ) {
goto cleanup;
}

View file

@ -334,7 +334,7 @@ static void mark_as_error(dc_context_t* mailbox, dc_msg_t* msg)
}
dc_sqlite3_lock(mailbox->m_sql);
dc_update_msg_state__(mailbox, msg->m_id, MR_STATE_OUT_ERROR);
dc_update_msg_state__(mailbox, msg->m_id, DC_STATE_OUT_ERROR);
dc_sqlite3_unlock(mailbox->m_sql);
mailbox->m_cb(mailbox, DC_EVENT_MSGS_CHANGED, msg->m_chat_id, 0);
}
@ -413,7 +413,7 @@ static void dc_job_do_DC_JOB_SEND_MSG_TO_SMTP(dc_context_t* mailbox, dc_job_t* j
free(emlname);
}
dc_update_msg_state__(mailbox, mimefactory.m_msg->m_id, MR_STATE_OUT_DELIVERED);
dc_update_msg_state__(mailbox, mimefactory.m_msg->m_id, DC_STATE_OUT_DELIVERED);
if( mimefactory.m_out_encrypted && dc_param_get_int(mimefactory.m_msg->m_param, DC_PARAM_GUARANTEE_E2EE, 0)==0 ) {
dc_param_set_int(mimefactory.m_msg->m_param, DC_PARAM_GUARANTEE_E2EE, 1); /* can upgrade to E2EE - fine! */
dc_msg_save_param_to_disk__(mimefactory.m_msg);

View file

@ -50,11 +50,11 @@ static void log_vprintf(dc_context_t* mailbox, int event, int code, const char*
/* format message from variable parameters or translate very comming errors */
if( code == DC_ERROR_SELF_NOT_IN_GROUP )
{
msg = mrstock_str(MR_STR_SELFNOTINGRP);
msg = dc_stock_str(DC_STR_SELFNOTINGRP);
}
else if( code == DC_ERROR_NO_NETWORK )
{
msg = mrstock_str(MR_STR_NONETWORK);
msg = dc_stock_str(DC_STR_NONETWORK);
}
else if( msg_format )
{
@ -79,7 +79,7 @@ static void log_vprintf(dc_context_t* mailbox, int event, int code, const char*
free(mailbox->m_log_ringbuf[mailbox->m_log_ringbuf_pos]);
mailbox->m_log_ringbuf[mailbox->m_log_ringbuf_pos] = msg;
mailbox->m_log_ringbuf_times[mailbox->m_log_ringbuf_pos] = time(NULL);
mailbox->m_log_ringbuf_pos = (mailbox->m_log_ringbuf_pos+1) % MR_LOG_RINGBUF_SIZE;
mailbox->m_log_ringbuf_pos = (mailbox->m_log_ringbuf_pos+1) % DC_LOG_RINGBUF_SIZE;
pthread_mutex_unlock(&mailbox->m_log_ringbuf_critical);
}

View file

@ -209,14 +209,14 @@ void dc_lot_fill(dc_lot_t* ths, const dc_msg_t* msg, const dc_chat_t* chat, cons
return;
}
if( msg->m_from_id == MR_CONTACT_ID_SELF )
if( msg->m_from_id == DC_CONTACT_ID_SELF )
{
if( dc_msg_is_info(msg) ) {
ths->m_text1 = NULL;
ths->m_text1_meaning = 0;
}
else {
ths->m_text1 = mrstock_str(MR_STR_SELF);
ths->m_text1 = dc_stock_str(DC_STR_SELF);
ths->m_text1_meaning = MR_TEXT1_SELF;
}
}
@ -225,7 +225,7 @@ void dc_lot_fill(dc_lot_t* ths, const dc_msg_t* msg, const dc_chat_t* chat, cons
ths->m_text1 = NULL;
ths->m_text1_meaning = 0;
}
else if( MR_CHAT_TYPE_IS_MULTI(chat->m_type) )
else if( DC_CHAT_TYPE_IS_MULTI(chat->m_type) )
{
if( dc_msg_is_info(msg) || contact==NULL ) {
ths->m_text1 = NULL;

View file

@ -96,7 +96,7 @@ static void load_from__(dc_mimefactory_t* factory)
factory->m_selfstatus = dc_sqlite3_get_config__(factory->m_context->m_sql, "selfstatus", NULL);
if( factory->m_selfstatus == NULL ) {
factory->m_selfstatus = mrstock_str(MR_STR_STATUSLINE);
factory->m_selfstatus = dc_stock_str(DC_STR_STATUSLINE);
}
}
@ -105,7 +105,7 @@ int dc_mimefactory_load_msg(dc_mimefactory_t* factory, uint32_t msg_id)
{
int success = 0, locked = 0;
if( factory == NULL || msg_id <= MR_MSG_ID_LAST_SPECIAL
if( factory == NULL || msg_id <= DC_MSG_ID_LAST_SPECIAL
|| factory->m_context == NULL
|| factory->m_msg /*call empty() before */ ) {
goto cleanup;
@ -139,7 +139,7 @@ int dc_mimefactory_load_msg(dc_mimefactory_t* factory, uint32_t msg_id)
"SELECT c.authname, c.addr "
" FROM chats_contacts cc "
" LEFT JOIN contacts c ON cc.contact_id=c.id "
" WHERE cc.chat_id=? AND cc.contact_id>" DC_STRINGIFY(MR_CONTACT_ID_LAST_SPECIAL) ";");
" WHERE cc.chat_id=? AND cc.contact_id>" DC_STRINGIFY(DC_CONTACT_ID_LAST_SPECIAL) ";");
sqlite3_bind_int(stmt, 1, factory->m_msg->m_chat_id);
while( sqlite3_step(stmt) == SQLITE_ROW )
{
@ -189,7 +189,7 @@ int dc_mimefactory_load_msg(dc_mimefactory_t* factory, uint32_t msg_id)
sqlite3_stmt* stmt = dc_sqlite3_predefine__(mailbox->m_sql, SELECT_rfc724_FROM_msgs_ORDER_BY_timestamp_LIMIT_1,
"SELECT rfc724_mid FROM msgs WHERE timestamp=(SELECT max(timestamp) FROM msgs WHERE chat_id=? AND from_id!=?);");
sqlite3_bind_int (stmt, 1, factory->m_msg->m_chat_id);
sqlite3_bind_int (stmt, 2, MR_CONTACT_ID_SELF);
sqlite3_bind_int (stmt, 2, DC_CONTACT_ID_SELF);
if( sqlite3_step(stmt) == SQLITE_ROW ) {
factory->m_predecessor = strdup_keep_null((const char*)sqlite3_column_text(stmt, 0));
}
@ -268,11 +268,11 @@ int dc_mimefactory_load_mdn(dc_mimefactory_t* factory, uint32_t msg_id)
}
if( contact->m_blocked
|| factory->m_msg->m_chat_id<=MR_CHAT_ID_LAST_SPECIAL/* Do not send MDNs trash etc.; chats.blocked is already checked by the caller in dc_markseen_msgs() */ ) {
|| factory->m_msg->m_chat_id<=DC_CHAT_ID_LAST_SPECIAL/* Do not send MDNs trash etc.; chats.blocked is already checked by the caller in dc_markseen_msgs() */ ) {
goto cleanup;
}
if( factory->m_msg->m_from_id <= MR_CONTACT_ID_LAST_SPECIAL ) {
if( factory->m_msg->m_from_id <= DC_CONTACT_ID_LAST_SPECIAL ) {
goto cleanup;
}
@ -447,15 +447,15 @@ static char* get_subject(const dc_chat_t* chat, const dc_msg_t* msg, int afwd_em
if( dc_param_get_int(msg->m_param, DC_PARAM_CMD, 0) == DC_CMD_AUTOCRYPT_SETUP_MESSAGE )
{
ret = mrstock_str(MR_STR_AC_SETUP_MSG_SUBJECT); /* do not add the "Chat:" prefix for setup messages */
ret = dc_stock_str(DC_STR_AC_SETUP_MSG_SUBJECT); /* do not add the "Chat:" prefix for setup messages */
}
else if( MR_CHAT_TYPE_IS_MULTI(chat->m_type) )
else if( DC_CHAT_TYPE_IS_MULTI(chat->m_type) )
{
ret = dc_mprintf(MR_CHAT_PREFIX " %s: %s%s", chat->m_name, fwd, raw_subject);
ret = dc_mprintf(DC_CHAT_PREFIX " %s: %s%s", chat->m_name, fwd, raw_subject);
}
else
{
ret = dc_mprintf(MR_CHAT_PREFIX " %s%s", fwd, raw_subject);
ret = dc_mprintf(DC_CHAT_PREFIX " %s%s", fwd, raw_subject);
}
free(raw_subject);
@ -550,7 +550,7 @@ int dc_mimefactory_render(dc_mimefactory_t* factory)
struct mailmime* meta_part = NULL;
char* placeholdertext = NULL;
if( chat->m_type == MR_CHAT_TYPE_VERIFIED_GROUP ) {
if( chat->m_type == DC_CHAT_TYPE_VERIFIED_GROUP ) {
mailimf_fields_add(imf_fields, mailimf_field_new_custom(strdup("Chat-Verified"), strdup("1")));
force_plaintext = 0;
e2ee_guaranteed = 1;
@ -564,7 +564,7 @@ int dc_mimefactory_render(dc_mimefactory_t* factory)
/* build header etc. */
int command = dc_param_get_int(msg->m_param, DC_PARAM_CMD, 0);
if( MR_CHAT_TYPE_IS_MULTI(chat->m_type) )
if( DC_CHAT_TYPE_IS_MULTI(chat->m_type) )
{
mailimf_fields_add(imf_fields, mailimf_field_new_custom(strdup("Chat-Group-ID"), safe_strdup(chat->m_grpid)));
mailimf_fields_add(imf_fields, mailimf_field_new_custom(strdup("Chat-Group-Name"), dc_encode_header_words(chat->m_name)));
@ -605,7 +605,7 @@ int dc_mimefactory_render(dc_mimefactory_t* factory)
if( command == DC_CMD_AUTOCRYPT_SETUP_MESSAGE ) {
mailimf_fields_add(imf_fields, mailimf_field_new_custom(strdup("Autocrypt-Setup-Message"), strdup("v1")));
placeholdertext = mrstock_str(MR_STR_AC_SETUP_MSG_BODY);
placeholdertext = dc_stock_str(DC_STR_AC_SETUP_MSG_BODY);
}
if( command == DC_CMD_SECUREJOIN_MESSAGE ) {
@ -725,12 +725,12 @@ int dc_mimefactory_render(dc_mimefactory_t* factory)
/* first body part: always human-readable, always REQUIRED by RFC 6522 */
char *p1 = NULL, *p2 = NULL;
if( dc_param_get_int(factory->m_msg->m_param, DC_PARAM_GUARANTEE_E2EE, 0) ) {
p1 = mrstock_str(MR_STR_ENCRYPTEDMSG); /* we SHOULD NOT spread encrypted subjects, date etc. in potentially unencrypted MDNs */
p1 = dc_stock_str(DC_STR_ENCRYPTEDMSG); /* we SHOULD NOT spread encrypted subjects, date etc. in potentially unencrypted MDNs */
}
else {
p1 = dc_msg_get_summarytext(factory->m_msg, APPROX_SUBJECT_CHARS);
}
p2 = mrstock_str_repl_string(MR_STR_READRCPT_MAILBODY, p1);
p2 = dc_stock_str_repl_string(DC_STR_READRCPT_MAILBODY, p1);
message_text = dc_mprintf("%s" LINEEND, p2);
free(p2);
free(p1);
@ -778,7 +778,7 @@ int dc_mimefactory_render(dc_mimefactory_t* factory)
*************************************************************************/
if( factory->m_loaded==DC_MF_MDN_LOADED ) {
char* e = mrstock_str(MR_STR_READRCPT); subject_str = dc_mprintf(MR_CHAT_PREFIX " %s", e); free(e);
char* e = dc_stock_str(DC_STR_READRCPT); subject_str = dc_mprintf(DC_CHAT_PREFIX " %s", e); free(e);
}
else {
subject_str = get_subject(factory->m_chat, factory->m_msg, afwd_email);

View file

@ -1306,7 +1306,7 @@ static int dc_mimeparser_parse_mime_recursive(dc_mimeparser_t* ths, struct mailm
dc_mimepart_t* part = mrmimepart_new();
part->m_type = MR_MSG_TEXT;
char* msg_body = mrstock_str(MR_STR_CANTDECRYPT_MSG_BODY);
char* msg_body = dc_stock_str(DC_STR_CANTDECRYPT_MSG_BODY);
part->m_msg = dc_mprintf(DC_EDITORIAL_OPEN "%s" DC_EDITORIAL_CLOSE, msg_body);
free(msg_body);
@ -1556,7 +1556,7 @@ void dc_mimeparser_parse(dc_mimeparser_t* ths, const char* body_not_terminated,
if( (p-ths->m_subject) == 2 /*Re: etc.*/
|| (p-ths->m_subject) == 3 /*Fwd: etc.*/
|| ths->m_is_send_by_messenger
|| strstr(ths->m_subject, MR_CHAT_PREFIX)!=NULL ) {
|| strstr(ths->m_subject, DC_CHAT_PREFIX)!=NULL ) {
prepend_subject = 0;
}
}

View file

@ -176,7 +176,7 @@ uint32_t dc_msg_get_chat_id(const dc_msg_t* msg)
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
return 0;
}
return msg->m_chat_blocked? MR_CHAT_ID_DEADDROP : msg->m_chat_id;
return msg->m_chat_blocked? DC_CHAT_ID_DEADDROP : msg->m_chat_id;
}
@ -467,7 +467,7 @@ dc_lot_t* dc_msg_get_mediainfo(const dc_msg_t* msg)
goto cleanup;
}
ret->m_text1 = safe_strdup((contact->m_name&&contact->m_name[0])? contact->m_name : contact->m_addr);
ret->m_text2 = mrstock_str(MR_STR_VOICEMESSAGE);
ret->m_text2 = dc_stock_str(DC_STR_VOICEMESSAGE);
}
else
{
@ -485,7 +485,7 @@ dc_lot_t* dc_msg_get_mediainfo(const dc_msg_t* msg)
}
dc_msg_get_authorNtitle_from_filename(pathNfilename, &ret->m_text1, &ret->m_text2);
if( ret->m_text1 == NULL && ret->m_text2 != NULL ) {
ret->m_text1 = mrstock_str(MR_STR_AUDIO);
ret->m_text1 = dc_stock_str(DC_STR_AUDIO);
}
}
@ -651,7 +651,7 @@ dc_lot_t* dc_msg_get_summary(const dc_msg_t* msg, const dc_chat_t* chat)
chat = chat_to_delete;
}
if( msg->m_from_id != MR_CONTACT_ID_SELF && MR_CHAT_TYPE_IS_MULTI(chat->m_type) ) {
if( msg->m_from_id != DC_CONTACT_ID_SELF && DC_CHAT_TYPE_IS_MULTI(chat->m_type) ) {
contact = dc_get_contact(chat->m_context, msg->m_from_id);
}
@ -704,7 +704,7 @@ int dc_msg_is_sent(const dc_msg_t* msg)
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
return 0;
}
return (msg->m_state >= MR_STATE_OUT_DELIVERED)? 1 : 0;
return (msg->m_state >= DC_STATE_OUT_DELIVERED)? 1 : 0;
}
@ -784,8 +784,8 @@ int dc_msg_is_info(const dc_msg_t* msg)
int cmd = dc_param_get_int(msg->m_param, DC_PARAM_CMD, 0);
if( msg->m_from_id == MR_CONTACT_ID_DEVICE
|| msg->m_to_id == MR_CONTACT_ID_DEVICE
if( msg->m_from_id == DC_CONTACT_ID_DEVICE
|| msg->m_to_id == DC_CONTACT_ID_DEVICE
|| (cmd && cmd != DC_CMD_AUTOCRYPT_SETUP_MESSAGE) ) {
return 1;
}
@ -1039,19 +1039,19 @@ char* dc_msg_get_summarytext_by_raw(int type, const char* text, dc_param_t* para
switch( type ) {
case MR_MSG_IMAGE:
ret = mrstock_str(MR_STR_IMAGE);
ret = dc_stock_str(DC_STR_IMAGE);
break;
case MR_MSG_GIF:
ret = mrstock_str(MR_STR_GIF);
ret = dc_stock_str(DC_STR_GIF);
break;
case MR_MSG_VIDEO:
ret = mrstock_str(MR_STR_VIDEO);
ret = dc_stock_str(DC_STR_VIDEO);
break;
case MR_MSG_VOICE:
ret = mrstock_str(MR_STR_VOICEMESSAGE);
ret = dc_stock_str(DC_STR_VOICEMESSAGE);
break;
case MR_MSG_AUDIO:
@ -1059,18 +1059,18 @@ char* dc_msg_get_summarytext_by_raw(int type, const char* text, dc_param_t* para
pathNfilename = dc_param_get(param, DC_PARAM_FILE, "ErrFilename");
dc_msg_get_authorNtitle_from_filename(pathNfilename, NULL, &value);
}
label = mrstock_str(MR_STR_AUDIO);
label = dc_stock_str(DC_STR_AUDIO);
ret = dc_mprintf("%s: %s", label, value);
break;
case MR_MSG_FILE:
if( dc_param_get_int(param, DC_PARAM_CMD, 0)==DC_CMD_AUTOCRYPT_SETUP_MESSAGE ) {
ret = mrstock_str(MR_STR_AC_SETUP_MSG_SUBJECT);
ret = dc_stock_str(DC_STR_AC_SETUP_MSG_SUBJECT);
}
else {
pathNfilename = dc_param_get(param, DC_PARAM_FILE, "ErrFilename");
value = mr_get_filename(pathNfilename);
label = mrstock_str(MR_STR_FILE);
label = dc_stock_str(DC_STR_FILE);
ret = dc_mprintf("%s: %s", label, value);
}
break;

View file

@ -212,9 +212,9 @@ dc_lot_t* dc_check_qr(dc_context_t* context, const char* qr)
if( dc_apeerstate_load_by_fingerprint__(peerstate, context->m_sql, fingerprint) ) {
qr_parsed->m_state = MR_QR_FPR_OK;
qr_parsed->m_id = dc_add_or_lookup_contact__(context, NULL, peerstate->m_addr, MR_ORIGIN_UNHANDLED_QR_SCAN, NULL);
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, MR_CHAT_DEADDROP_BLOCKED, &chat_id, 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 {
@ -242,7 +242,7 @@ dc_lot_t* dc_check_qr(dc_context_t* context, const char* qr)
qr_parsed->m_state = MR_QR_ASK_VERIFYCONTACT;
}
qr_parsed->m_id = dc_add_or_lookup_contact__(context, name, addr, MR_ORIGIN_UNHANDLED_QR_SCAN, NULL);
qr_parsed->m_id = dc_add_or_lookup_contact__(context, name, addr, DC_ORIGIN_UNHANDLED_QR_SCAN, NULL);
qr_parsed->m_fingerprint = safe_strdup(fingerprint);
qr_parsed->m_invitenumber = safe_strdup(invitenumber);
qr_parsed->m_auth = safe_strdup(auth);
@ -255,7 +255,7 @@ 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_id = dc_add_or_lookup_contact__(context, name, addr, MR_ORIGIN_UNHANDLED_QR_SCAN, NULL);
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 )
{

View file

@ -134,7 +134,7 @@ static int is_known_rfc724_mid__(dc_context_t* mailbox, const char* rfc724_mid)
"SELECT m.id FROM msgs m "
" LEFT JOIN chats c ON m.chat_id=c.id "
" WHERE m.rfc724_mid=? "
" AND m.chat_id>" DC_STRINGIFY(MR_CHAT_ID_LAST_SPECIAL)
" AND m.chat_id>" DC_STRINGIFY(DC_CHAT_ID_LAST_SPECIAL)
" AND c.blocked=0;");
sqlite3_bind_text(stmt, 1, rfc724_mid, -1, SQLITE_STATIC);
if( sqlite3_step(stmt) == SQLITE_ROW ) {
@ -212,7 +212,7 @@ static int is_msgrmsg_rfc724_mid__(dc_context_t* mailbox, const char* rfc724_mid
"SELECT id FROM msgs "
" WHERE rfc724_mid=? "
" AND msgrmsg!=0 "
" AND chat_id>" DC_STRINGIFY(MR_CHAT_ID_LAST_SPECIAL) ";");
" AND chat_id>" DC_STRINGIFY(DC_CHAT_ID_LAST_SPECIAL) ";");
sqlite3_bind_text(stmt, 1, rfc724_mid, -1, SQLITE_STATIC);
if( sqlite3_step(stmt) == SQLITE_ROW ) {
return 1;
@ -344,7 +344,7 @@ static dc_array_t* search_chat_ids_by_contact_ids(dc_context_t* mailbox, const d
for( i = 0; i < iCnt; i++ ) {
uint32_t curr_id = dc_array_get_id(unsorted_contact_ids, i);
if( curr_id != MR_CONTACT_ID_SELF && !dc_array_search_id(contact_ids, curr_id, NULL) ) {
if( curr_id != DC_CONTACT_ID_SELF && !dc_array_search_id(contact_ids, curr_id, NULL) ) {
dc_array_add_id(contact_ids, curr_id);
}
}
@ -362,8 +362,8 @@ static dc_array_t* search_chat_ids_by_contact_ids(dc_context_t* mailbox, const d
" FROM chats_contacts cc "
" LEFT JOIN chats c ON c.id=cc.chat_id "
" WHERE cc.chat_id IN(SELECT chat_id FROM chats_contacts WHERE contact_id IN(%s))"
" AND c.type=" DC_STRINGIFY(MR_CHAT_TYPE_GROUP) /* no verified groups and no single chats (which are equal to a group with a single member and without SELF) */
" AND cc.contact_id!=" DC_STRINGIFY(MR_CONTACT_ID_SELF) /* ignore SELF, we've also removed it above - if the user has left the group, it is still the same group */
" AND c.type=" DC_STRINGIFY(DC_CHAT_TYPE_GROUP) /* no verified groups and no single chats (which are equal to a group with a single member and without SELF) */
" AND cc.contact_id!=" DC_STRINGIFY(DC_CONTACT_ID_SELF) /* ignore SELF, we've also removed it above - if the user has left the group, it is still the same group */
" ORDER BY cc.chat_id, cc.contact_id;",
contact_ids_str);
stmt = dc_sqlite3_prepare_v2_(mailbox->m_sql, q3);
@ -426,7 +426,7 @@ static char* create_adhoc_grp_id__(dc_context_t* mailbox, dc_array_t* member_ids
dc_strbuilder_init(&member_cs, 0);
/* collect all addresses and sort them */
q3 = sqlite3_mprintf("SELECT addr FROM contacts WHERE id IN(%s) AND id!=" DC_STRINGIFY(MR_CONTACT_ID_SELF), member_ids_str);
q3 = sqlite3_mprintf("SELECT addr FROM contacts WHERE id IN(%s) AND id!=" DC_STRINGIFY(DC_CONTACT_ID_SELF), member_ids_str);
stmt = dc_sqlite3_prepare_v2_(mailbox->m_sql, q3);
addr = dc_sqlite3_get_config__(mailbox->m_sql, "configured_addr", "no-self");
mr_strlower_in_place(addr);
@ -480,7 +480,7 @@ static uint32_t create_group_record__(dc_context_t* mailbox, const char* grpid,
stmt = dc_sqlite3_prepare_v2_(mailbox->m_sql,
"INSERT INTO chats (type, name, grpid, blocked) VALUES(?, ?, ?, ?);");
sqlite3_bind_int (stmt, 1, create_verified? MR_CHAT_TYPE_VERIFIED_GROUP : MR_CHAT_TYPE_GROUP);
sqlite3_bind_int (stmt, 1, create_verified? DC_CHAT_TYPE_VERIFIED_GROUP : DC_CHAT_TYPE_GROUP);
sqlite3_bind_text(stmt, 2, grpname, -1, SQLITE_STATIC);
sqlite3_bind_text(stmt, 3, grpid, -1, SQLITE_STATIC);
sqlite3_bind_int (stmt, 4, create_blocked);
@ -521,7 +521,7 @@ static void create_or_lookup_adhoc_group__(dc_context_t* mailbox, dc_mimeparser_
}
member_ids = dc_array_duplicate(to_ids);
if( !dc_array_search_id(member_ids, from_id, NULL) ) { dc_array_add_id(member_ids, from_id); }
if( !dc_array_search_id(member_ids, MR_CONTACT_ID_SELF, NULL) ) { dc_array_add_id(member_ids, MR_CONTACT_ID_SELF); }
if( !dc_array_search_id(member_ids, DC_CONTACT_ID_SELF, NULL) ) { dc_array_add_id(member_ids, DC_CONTACT_ID_SELF); }
if( dc_array_get_cnt(member_ids) < 3 ) {
goto cleanup; /* too few contacts given */
}
@ -559,7 +559,7 @@ static void create_or_lookup_adhoc_group__(dc_context_t* mailbox, dc_mimeparser_
grpname = safe_strdup(mime_parser->m_subject);
}
else {
grpname = mrstock_str_repl_pl(MR_STR_MEMBER, dc_array_get_cnt(member_ids));
grpname = dc_stock_str_repl_pl(DC_STR_MEMBER, dc_array_get_cnt(member_ids));
}
/* create group record */
@ -815,10 +815,10 @@ static void create_or_lookup_group__(dc_context_t* mailbox, dc_mimeparser_t* mim
}
/* again, check chat_id */
if( chat_id <= MR_CHAT_ID_LAST_SPECIAL ) {
if( chat_id <= DC_CHAT_ID_LAST_SPECIAL ) {
chat_id = 0;
if( group_explicitly_left ) {
chat_id = MR_CHAT_ID_TRASH; /* we got a message for a chat we've deleted - do not show this even as a normal chat */
chat_id = DC_CHAT_ID_TRASH; /* we got a message for a chat we've deleted - do not show this even as a normal chat */
}
else {
create_or_lookup_adhoc_group__(mailbox, mime_parser, create_blocked, from_id, to_ids, &chat_id, &chat_id_blocked);
@ -885,10 +885,10 @@ static void create_or_lookup_group__(dc_context_t* mailbox, dc_mimeparser_t* mim
sqlite3_finalize(stmt);
if( skip==NULL || strcasecmp(self_addr, skip) != 0 ) {
dc_add_to_chat_contacts_table__(mailbox, chat_id, MR_CONTACT_ID_SELF);
dc_add_to_chat_contacts_table__(mailbox, chat_id, DC_CONTACT_ID_SELF);
}
if( from_id > MR_CONTACT_ID_LAST_SPECIAL ) {
if( from_id > DC_CONTACT_ID_LAST_SPECIAL ) {
if( dc_contact_addr_equals__(mailbox, from_id, self_addr)==0
&& (skip==NULL || dc_contact_addr_equals__(mailbox, from_id, skip)==0) ) {
dc_add_to_chat_contacts_table__(mailbox, chat_id, from_id);
@ -1031,14 +1031,14 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
{
int check_self;
dc_array_t* from_list = dc_array_new(mailbox, 16);
dc_add_or_lookup_contacts_by_mailbox_list__(mailbox, fld_from->frm_mb_list, MR_ORIGIN_INCOMING_UNKNOWN_FROM, from_list, &check_self);
dc_add_or_lookup_contacts_by_mailbox_list__(mailbox, fld_from->frm_mb_list, DC_ORIGIN_INCOMING_UNKNOWN_FROM, from_list, &check_self);
if( check_self )
{
incoming = 0;
if( dc_mimeparser_sender_equals_recipient(mime_parser) )
{
from_id = MR_CONTACT_ID_SELF;
from_id = DC_CONTACT_ID_SELF;
}
}
else
@ -1061,7 +1061,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
if( fld_to )
{
dc_add_or_lookup_contacts_by_address_list__(mailbox, fld_to->to_addr_list /*!= NULL*/,
outgoing? MR_ORIGIN_OUTGOING_TO : (incoming_origin>=MR_ORIGIN_MIN_VERIFIED? MR_ORIGIN_INCOMING_TO : MR_ORIGIN_INCOMING_UNKNOWN_TO), to_ids, &to_self);
outgoing? DC_ORIGIN_OUTGOING_TO : (incoming_origin>=DC_ORIGIN_MIN_VERIFIED? DC_ORIGIN_INCOMING_TO : DC_ORIGIN_INCOMING_UNKNOWN_TO), to_ids, &to_self);
}
}
@ -1080,7 +1080,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
struct mailimf_cc* fld_cc = field->fld_data.fld_cc;
if( fld_cc ) {
dc_add_or_lookup_contacts_by_address_list__(mailbox, fld_cc->cc_addr_list,
outgoing? MR_ORIGIN_OUTGOING_CC : (incoming_origin>=MR_ORIGIN_MIN_VERIFIED? MR_ORIGIN_INCOMING_CC : MR_ORIGIN_INCOMING_UNKNOWN_CC), to_ids, NULL);
outgoing? DC_ORIGIN_OUTGOING_CC : (incoming_origin>=DC_ORIGIN_MIN_VERIFIED? DC_ORIGIN_INCOMING_CC : DC_ORIGIN_INCOMING_UNKNOWN_CC), to_ids, NULL);
}
}
@ -1125,8 +1125,8 @@ 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)? MR_STATE_IN_SEEN : MR_STATE_IN_FRESH;
to_id = MR_CONTACT_ID_SELF;
state = (flags&MR_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)
assert( chat_id == 0 );
@ -1135,7 +1135,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
dc_sqlite3_unlock(mailbox->m_sql);
if( dc_handle_securejoin_handshake(mailbox, mime_parser, from_id) == MR_IS_HANDSHAKE_STOP_NORMAL_PROCESSING ) {
hidden = 1;
state = MR_STATE_IN_SEEN;
state = DC_STATE_IN_SEEN;
}
dc_sqlite3_lock(mailbox->m_sql);
dc_sqlite3_begin_transaction__(mailbox->m_sql);
@ -1152,7 +1152,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
{
/* try to create a group
(groups appear automatically only if the _sender_ is known, see core issue #54) */
int create_blocked = ((test_normal_chat_id&&test_normal_chat_id_blocked==MR_CHAT_NOT_BLOCKED) || incoming_origin>=MR_ORIGIN_MIN_START_NEW_NCHAT/*always false, for now*/)? MR_CHAT_NOT_BLOCKED : MR_CHAT_DEADDROP_BLOCKED;
int create_blocked = ((test_normal_chat_id&&test_normal_chat_id_blocked==DC_CHAT_NOT_BLOCKED) || incoming_origin>=DC_ORIGIN_MIN_START_NEW_NCHAT/*always false, for now*/)? DC_CHAT_NOT_BLOCKED : DC_CHAT_DEADDROP_BLOCKED;
create_or_lookup_group__(mailbox, mime_parser, create_blocked, from_id, to_ids, &chat_id, &chat_id_blocked);
if( chat_id && chat_id_blocked && !create_blocked ) {
dc_unblock_chat__(mailbox, chat_id);
@ -1164,7 +1164,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
{
/* check if the message belongs to a mailing list */
if( dc_mimeparser_is_mailinglist_message(mime_parser) ) {
chat_id = MR_CHAT_ID_TRASH;
chat_id = DC_CHAT_ID_TRASH;
dc_log_info(mailbox, 0, "Message belongs to a mailing list and is ignored.");
}
}
@ -1172,7 +1172,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
if( chat_id == 0 )
{
/* try to create a normal chat */
int create_blocked = (incoming_origin>=MR_ORIGIN_MIN_START_NEW_NCHAT/*always false, for now*/ || from_id==to_id)? MR_CHAT_NOT_BLOCKED : MR_CHAT_DEADDROP_BLOCKED;
int create_blocked = (incoming_origin>=DC_ORIGIN_MIN_START_NEW_NCHAT/*always false, for now*/ || from_id==to_id)? DC_CHAT_NOT_BLOCKED : DC_CHAT_DEADDROP_BLOCKED;
if( test_normal_chat_id ) {
chat_id = test_normal_chat_id;
chat_id_blocked = test_normal_chat_id_blocked;
@ -1187,9 +1187,9 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
chat_id_blocked = 0;
}
else if( dc_is_reply_to_known_message__(mailbox, mime_parser) ) {
dc_scaleup_contact_origin__(mailbox, from_id, MR_ORIGIN_INCOMING_REPLY_TO); /* we do not want any chat to be created implicitly. Because of the origin-scale-up, the contact requests will pop up and this should be just fine. */
dc_scaleup_contact_origin__(mailbox, from_id, DC_ORIGIN_INCOMING_REPLY_TO); /* we do not want any chat to be created implicitly. Because of the origin-scale-up, the contact requests will pop up and this should be just fine. */
dc_log_info(mailbox, 0, "Message is a reply to a known message, mark sender as known.");
incoming_origin = MR_MAX(incoming_origin, MR_ORIGIN_INCOMING_REPLY_TO);
incoming_origin = MR_MAX(incoming_origin, DC_ORIGIN_INCOMING_REPLY_TO);
}
}
}
@ -1197,28 +1197,28 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
if( chat_id == 0 )
{
/* maybe from_id is null or sth. else is suspicious, move message to trash */
chat_id = MR_CHAT_ID_TRASH;
chat_id = DC_CHAT_ID_TRASH;
}
/* degrade state for unknown senders and non-delta messages
(the latter may be removed if we run into spam problems, currently this is fine)
(noticed messages do count as being unread; therefore, the deaddrop will not popup in the chatlist) */
if( chat_id_blocked && state == MR_STATE_IN_FRESH ) {
if( incoming_origin<MR_ORIGIN_MIN_VERIFIED && mime_parser->m_is_send_by_messenger==0 ) {
state = MR_STATE_IN_NOTICED;
if( chat_id_blocked && state == DC_STATE_IN_FRESH ) {
if( incoming_origin<DC_ORIGIN_MIN_VERIFIED && mime_parser->m_is_send_by_messenger==0 ) {
state = DC_STATE_IN_NOTICED;
}
}
}
else /* outgoing */
{
state = MR_STATE_OUT_DELIVERED; /* the mail is on the IMAP server, probably it is also delivered. We cannot recreate other states (read, error). */
from_id = MR_CONTACT_ID_SELF;
state = DC_STATE_OUT_DELIVERED; /* the mail is on the IMAP server, probably it is also delivered. We cannot recreate other states (read, error). */
from_id = DC_CONTACT_ID_SELF;
if( dc_array_get_cnt(to_ids) >= 1 ) {
to_id = dc_array_get_id(to_ids, 0);
if( chat_id == 0 )
{
create_or_lookup_group__(mailbox, mime_parser, MR_CHAT_NOT_BLOCKED, from_id, to_ids, &chat_id, &chat_id_blocked);
create_or_lookup_group__(mailbox, mime_parser, DC_CHAT_NOT_BLOCKED, from_id, to_ids, &chat_id, &chat_id_blocked);
if( chat_id && chat_id_blocked ) {
dc_unblock_chat__(mailbox, chat_id);
chat_id_blocked = 0;
@ -1227,7 +1227,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
if( chat_id == 0 )
{
int create_blocked = (mime_parser->m_is_send_by_messenger && !dc_is_contact_blocked__(mailbox, to_id))? MR_CHAT_NOT_BLOCKED : MR_CHAT_DEADDROP_BLOCKED;
int create_blocked = (mime_parser->m_is_send_by_messenger && !dc_is_contact_blocked__(mailbox, to_id))? DC_CHAT_NOT_BLOCKED : DC_CHAT_DEADDROP_BLOCKED;
dc_create_or_lookup_nchat_by_contact_id__(mailbox, to_id, create_blocked, &chat_id, &chat_id_blocked);
if( chat_id && chat_id_blocked && !create_blocked ) {
dc_unblock_chat__(mailbox, chat_id);
@ -1238,8 +1238,8 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
if( chat_id == 0 ) {
if( dc_array_get_cnt(to_ids) == 0 && to_self ) {
/* from_id == to_id == MR_CONTACT_ID_SELF - this is a self-sent messages, maybe an Autocrypt Setup Message */
dc_create_or_lookup_nchat_by_contact_id__(mailbox, MR_CONTACT_ID_SELF, MR_CHAT_NOT_BLOCKED, &chat_id, &chat_id_blocked);
/* from_id == to_id == DC_CONTACT_ID_SELF - this is a self-sent messages, maybe an Autocrypt Setup Message */
dc_create_or_lookup_nchat_by_contact_id__(mailbox, DC_CONTACT_ID_SELF, DC_CHAT_NOT_BLOCKED, &chat_id, &chat_id_blocked);
if( chat_id && chat_id_blocked ) {
dc_unblock_chat__(mailbox, chat_id);
chat_id_blocked = 0;
@ -1248,7 +1248,7 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
}
if( chat_id == 0 ) {
chat_id = MR_CHAT_ID_TRASH;
chat_id = DC_CHAT_ID_TRASH;
}
}
@ -1334,11 +1334,11 @@ void dc_receive_imf(dc_context_t* mailbox, const char* imf_raw_not_terminated, s
dc_log_info(mailbox, 0, "Message has %i parts and is assigned to chat #%i.", icnt, chat_id);
/* check event to send */
if( chat_id == MR_CHAT_ID_TRASH )
if( chat_id == DC_CHAT_ID_TRASH )
{
create_event_to_send = 0;
}
else if( incoming && state==MR_STATE_IN_FRESH )
else if( incoming && state==DC_STATE_IN_FRESH )
{
if( from_id_blocked ) {
create_event_to_send = 0;

View file

@ -71,7 +71,7 @@ void dc_handle_degrade_event(dc_context_t* context, dc_apeerstate_t* peerstate)
goto cleanup;
}
dc_create_or_lookup_nchat_by_contact_id__(context, contact_id, MR_CHAT_DEADDROP_BLOCKED, &contact_chat_id, NULL);
dc_create_or_lookup_nchat_by_contact_id__(context, contact_id, DC_CHAT_DEADDROP_BLOCKED, &contact_chat_id, NULL);
UNLOCK
@ -414,7 +414,7 @@ char* dc_get_securejoin_qr(dc_context_t* context, uint32_t group_chat_id)
{
// parameters used: a=g=x=i=s=
chat = dc_get_chat(context, group_chat_id);
if( chat == NULL || chat->m_type != MR_CHAT_TYPE_VERIFIED_GROUP ) {
if( chat == NULL || chat->m_type != DC_CHAT_TYPE_VERIFIED_GROUP ) {
dc_log_error(context, 0, "Secure join is only available for verified groups.");
goto cleanup;
}
@ -578,7 +578,7 @@ int dc_handle_securejoin_handshake(dc_context_t* context, dc_mimeparser_t* mimep
char* grpid = NULL;
int ret = 0;
if( context == NULL || mimeparser == NULL || contact_id <= MR_CONTACT_ID_LAST_SPECIAL ) {
if( context == NULL || mimeparser == NULL || contact_id <= DC_CONTACT_ID_LAST_SPECIAL ) {
goto cleanup;
}
@ -589,7 +589,7 @@ int dc_handle_securejoin_handshake(dc_context_t* context, dc_mimeparser_t* mimep
join_vg = (strncmp(step, "vg-", 3)==0);
LOCK
dc_create_or_lookup_nchat_by_contact_id__(context, contact_id, MR_CHAT_NOT_BLOCKED, &contact_chat_id, &contact_chat_id_blocked);
dc_create_or_lookup_nchat_by_contact_id__(context, contact_id, DC_CHAT_NOT_BLOCKED, &contact_chat_id, &contact_chat_id_blocked);
if( contact_chat_id_blocked ) {
dc_unblock_chat__(context, contact_chat_id);
}
@ -723,7 +723,7 @@ int dc_handle_securejoin_handshake(dc_context_t* context, dc_mimeparser_t* mimep
goto cleanup;
}
dc_scaleup_contact_origin__(context, contact_id, MR_ORIGIN_SECUREJOIN_INVITED);
dc_scaleup_contact_origin__(context, contact_id, DC_ORIGIN_SECUREJOIN_INVITED);
UNLOCK
dc_log_info(context, 0, "Auth verified.");
@ -796,7 +796,7 @@ int dc_handle_securejoin_handshake(dc_context_t* context, dc_mimeparser_t* mimep
goto cleanup;
}
dc_scaleup_contact_origin__(context, contact_id, MR_ORIGIN_SECUREJOIN_JOINED);
dc_scaleup_contact_origin__(context, contact_id, DC_ORIGIN_SECUREJOIN_JOINED);
UNLOCK
secure_connection_established(context, contact_chat_id);

View file

@ -207,7 +207,7 @@ int dc_sqlite3_open__(dc_sqlite3_t* ths, const char* dbfile, int flags)
dc_sqlite3_execute__(ths, "CREATE INDEX contacts_index1 ON contacts (name COLLATE NOCASE);"); /* needed for query contacts */
dc_sqlite3_execute__(ths, "CREATE INDEX contacts_index2 ON contacts (addr COLLATE NOCASE);"); /* needed for query and on receiving mails */
dc_sqlite3_execute__(ths, "INSERT INTO contacts (id,name,origin) VALUES (1,'self',262144), (2,'device',262144), (3,'rsvd',262144), (4,'rsvd',262144), (5,'rsvd',262144), (6,'rsvd',262144), (7,'rsvd',262144), (8,'rsvd',262144), (9,'rsvd',262144);");
#if !defined(MR_ORIGIN_INTERNAL) || MR_ORIGIN_INTERNAL!=262144
#if !defined(DC_ORIGIN_INTERNAL) || DC_ORIGIN_INTERNAL!=262144
#error
#endif
@ -223,10 +223,10 @@ int dc_sqlite3_open__(dc_sqlite3_t* ths, const char* dbfile, int flags)
dc_sqlite3_execute__(ths, "CREATE TABLE chats_contacts (chat_id INTEGER, contact_id INTEGER);");
dc_sqlite3_execute__(ths, "CREATE INDEX chats_contacts_index1 ON chats_contacts (chat_id);");
dc_sqlite3_execute__(ths, "INSERT INTO chats (id,type,name) VALUES (1,120,'deaddrop'), (2,120,'rsvd'), (3,120,'trash'), (4,120,'msgs_in_creation'), (5,120,'starred'), (6,120,'archivedlink'), (7,100,'rsvd'), (8,100,'rsvd'), (9,100,'rsvd');");
#if !defined(MR_CHAT_TYPE_SINGLE) || MR_CHAT_TYPE_SINGLE!=100 || MR_CHAT_TYPE_GROUP!=120 || \
MR_CHAT_ID_DEADDROP!=1 || MR_CHAT_ID_TRASH!=3 || \
MR_CHAT_ID_MSGS_IN_CREATION!=4 || MR_CHAT_ID_STARRED!=5 || MR_CHAT_ID_ARCHIVED_LINK!=6 || \
MR_CHAT_NOT_BLOCKED!=0 || MR_CHAT_MANUALLY_BLOCKED!=1 || MR_CHAT_DEADDROP_BLOCKED!=2
#if !defined(DC_CHAT_TYPE_SINGLE) || DC_CHAT_TYPE_SINGLE!=100 || DC_CHAT_TYPE_GROUP!=120 || \
DC_CHAT_ID_DEADDROP!=1 || DC_CHAT_ID_TRASH!=3 || \
DC_CHAT_ID_MSGS_IN_CREATION!=4 || DC_CHAT_ID_STARRED!=5 || DC_CHAT_ID_ARCHIVED_LINK!=6 || \
DC_CHAT_NOT_BLOCKED!=0 || DC_CHAT_MANUALLY_BLOCKED!=1 || DC_CHAT_DEADDROP_BLOCKED!=2
#error
#endif

View file

@ -39,48 +39,48 @@ dc_context_t* s_localize_mb_obj = NULL;
static char* default_string(int id, int qty)
{
switch( id ) {
case MR_STR_NOMESSAGES: return safe_strdup("No messages.");
case MR_STR_SELF: return safe_strdup("Me");
case MR_STR_DRAFT: return safe_strdup("Draft");
case MR_STR_MEMBER: return dc_mprintf("%i member(s)", qty);
case MR_STR_CONTACT: return dc_mprintf("%i contact(s)", qty);
case MR_STR_VOICEMESSAGE: return safe_strdup("Voice message");
case MR_STR_DEADDROP: return safe_strdup("Mailbox");
case MR_STR_IMAGE: return safe_strdup("Image");
case MR_STR_GIF: return safe_strdup("GIF");
case MR_STR_VIDEO: return safe_strdup("Video");
case MR_STR_AUDIO: return safe_strdup("Audio");
case MR_STR_FILE: return safe_strdup("File");
case MR_STR_ENCRYPTEDMSG: return safe_strdup("Encrypted message");
case MR_STR_STATUSLINE: return safe_strdup("Sent with my Delta Chat Messenger: https://delta.chat");
case MR_STR_NEWGROUPDRAFT: return safe_strdup("Hello, I've just created the group \"%1$s\" for us.");
case MR_STR_MSGGRPNAME: return safe_strdup("Group name changed from \"%1$s\" to \"%2$s\".");
case MR_STR_MSGGRPIMGCHANGED: return safe_strdup("Group image changed.");
case MR_STR_MSGADDMEMBER: return safe_strdup("Member %1$s added.");
case MR_STR_MSGDELMEMBER: return safe_strdup("Member %1$s removed.");
case MR_STR_MSGGROUPLEFT: return safe_strdup("Group left.");
case MR_STR_SELFNOTINGRP: return safe_strdup("You must be a member of the group to perform this action.");
case MR_STR_NONETWORK: return safe_strdup("No network available.");
case MR_STR_E2E_AVAILABLE: return safe_strdup("End-to-end encryption available.");
case MR_STR_ENCR_TRANSP: return safe_strdup("Transport-encryption.");
case MR_STR_ENCR_NONE: return safe_strdup("No encryption.");
case MR_STR_FINGERPRINTS: return safe_strdup("Fingerprints");
case MR_STR_READRCPT: return safe_strdup("Return receipt");
case MR_STR_READRCPT_MAILBODY: return safe_strdup("This is a return receipt for the message \"%1$s\".");
case MR_STR_MSGGRPIMGDELETED: return safe_strdup("Group image deleted.");
case MR_STR_E2E_PREFERRED: return safe_strdup("End-to-end encryption preferred.");
case MR_STR_ARCHIVEDCHATS: return safe_strdup("Archived chats");
case MR_STR_STARREDMSGS: return safe_strdup("Starred messages");
case MR_STR_AC_SETUP_MSG_SUBJECT: return safe_strdup("Autocrypt Setup Message");
case MR_STR_AC_SETUP_MSG_BODY: return safe_strdup("This is the Autocrypt Setup Message used to transfer your key between clients.\n\nTo decrypt and use your key, open the message in an Autocrypt-compliant client and enter the setup code presented on the generating device.");
case MR_STR_SELFTALK_SUBTITLE: return safe_strdup("Messages I sent to myself");
case MR_STR_CANTDECRYPT_MSG_BODY: return safe_strdup("This message was encrypted for another setup.");
case DC_STR_NOMESSAGES: return safe_strdup("No messages.");
case DC_STR_SELF: return safe_strdup("Me");
case DC_STR_DRAFT: return safe_strdup("Draft");
case DC_STR_MEMBER: return dc_mprintf("%i member(s)", qty);
case DC_STR_CONTACT: return dc_mprintf("%i contact(s)", qty);
case DC_STR_VOICEMESSAGE: return safe_strdup("Voice message");
case DC_STR_DEADDROP: return safe_strdup("Mailbox");
case DC_STR_IMAGE: return safe_strdup("Image");
case DC_STR_GIF: return safe_strdup("GIF");
case DC_STR_VIDEO: return safe_strdup("Video");
case DC_STR_AUDIO: return safe_strdup("Audio");
case DC_STR_FILE: return safe_strdup("File");
case DC_STR_ENCRYPTEDMSG: return safe_strdup("Encrypted message");
case DC_STR_STATUSLINE: return safe_strdup("Sent with my Delta Chat Messenger: https://delta.chat");
case DC_STR_NEWGROUPDRAFT: return safe_strdup("Hello, I've just created the group \"%1$s\" for us.");
case DC_STR_MSGGRPNAME: return safe_strdup("Group name changed from \"%1$s\" to \"%2$s\".");
case DC_STR_MSGGRPIMGCHANGED: return safe_strdup("Group image changed.");
case DC_STR_MSGADDMEMBER: return safe_strdup("Member %1$s added.");
case DC_STR_MSGDELMEMBER: return safe_strdup("Member %1$s removed.");
case DC_STR_MSGGROUPLEFT: return safe_strdup("Group left.");
case DC_STR_SELFNOTINGRP: return safe_strdup("You must be a member of the group to perform this action.");
case DC_STR_NONETWORK: return safe_strdup("No network available.");
case DC_STR_E2E_AVAILABLE: return safe_strdup("End-to-end encryption available.");
case DC_STR_ENCR_TRANSP: return safe_strdup("Transport-encryption.");
case DC_STR_ENCR_NONE: return safe_strdup("No encryption.");
case DC_STR_FINGERPRINTS: return safe_strdup("Fingerprints");
case DC_STR_READRCPT: return safe_strdup("Return receipt");
case DC_STR_READRCPT_MAILBODY: return safe_strdup("This is a return receipt for the message \"%1$s\".");
case DC_STR_MSGGRPIMGDELETED: return safe_strdup("Group image deleted.");
case DC_STR_E2E_PREFERRED: return safe_strdup("End-to-end encryption preferred.");
case DC_STR_ARCHIVEDCHATS: return safe_strdup("Archived chats");
case DC_STR_STARREDMSGS: return safe_strdup("Starred messages");
case DC_STR_AC_SETUP_MSG_SUBJECT: return safe_strdup("Autocrypt Setup Message");
case DC_STR_AC_SETUP_MSG_BODY: return safe_strdup("This is the Autocrypt Setup Message used to transfer your key between clients.\n\nTo decrypt and use your key, open the message in an Autocrypt-compliant client and enter the setup code presented on the generating device.");
case DC_STR_SELFTALK_SUBTITLE: return safe_strdup("Messages I sent to myself");
case DC_STR_CANTDECRYPT_MSG_BODY: return safe_strdup("This message was encrypted for another setup.");
}
return safe_strdup("ErrStr");
}
char* mrstock_str(int id) /* get the string with the given ID, the result must be free()'d! */
char* dc_stock_str(int id) /* get the string with the given ID, the result must be free()'d! */
{
char* ret = NULL;
if( s_localize_mb_obj && s_localize_mb_obj->m_cb ) {
@ -93,33 +93,33 @@ char* mrstock_str(int id) /* get the string with the given ID, the result must b
}
char* mrstock_str_repl_string(int id, const char* to_insert)
char* dc_stock_str_repl_string(int id, const char* to_insert)
{
char* p1 = mrstock_str(id);
char* p1 = dc_stock_str(id);
dc_str_replace(&p1, "%1$s", to_insert);
return p1;
}
char* mrstock_str_repl_int(int id, int to_insert_int)
char* dc_stock_str_repl_int(int id, int to_insert_int)
{
char* ret, *to_insert_str = dc_mprintf("%i", (int)to_insert_int);
ret = mrstock_str_repl_string(id, to_insert_str);
ret = dc_stock_str_repl_string(id, to_insert_str);
free(to_insert_str);
return ret;
}
char* mrstock_str_repl_string2(int id, const char* to_insert, const char* to_insert2)
char* dc_stock_str_repl_string2(int id, const char* to_insert, const char* to_insert2)
{
char* p1 = mrstock_str(id);
char* p1 = dc_stock_str(id);
dc_str_replace(&p1, "%1$s", to_insert);
dc_str_replace(&p1, "%2$s", to_insert2);
return p1;
}
char* mrstock_str_repl_pl(int id, int cnt)
char* dc_stock_str_repl_pl(int id, int cnt)
{
char* ret = NULL;
if( s_localize_mb_obj && s_localize_mb_obj->m_cb ) {

View file

@ -20,8 +20,8 @@
******************************************************************************/
#ifndef __MRSTOCK_H__
#define __MRSTOCK_H__
#ifndef __DC_STOCK_H__
#define __DC_STOCK_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -33,43 +33,43 @@ extern "C" {
/* Strings requested by DC_EVENT_GET_STRING and DC_EVENT_GET_QUANTITY_STRING */
#define MR_STR_FREE_ 0
#define MR_STR_NOMESSAGES 1
#define MR_STR_SELF 2
#define MR_STR_DRAFT 3
#define MR_STR_MEMBER 4
#define MR_STR_CONTACT 6
#define MR_STR_VOICEMESSAGE 7
#define MR_STR_DEADDROP 8
#define MR_STR_IMAGE 9
#define MR_STR_VIDEO 10
#define MR_STR_AUDIO 11
#define MR_STR_FILE 12
#define MR_STR_STATUSLINE 13
#define MR_STR_NEWGROUPDRAFT 14
#define MR_STR_MSGGRPNAME 15
#define MR_STR_MSGGRPIMGCHANGED 16
#define MR_STR_MSGADDMEMBER 17
#define MR_STR_MSGDELMEMBER 18
#define MR_STR_MSGGROUPLEFT 19
#define MR_STR_SELFNOTINGRP 21
#define MR_STR_NONETWORK 22
#define MR_STR_GIF 23
#define MR_STR_ENCRYPTEDMSG 24
#define MR_STR_E2E_AVAILABLE 25
#define MR_STR_ENCR_TRANSP 27
#define MR_STR_ENCR_NONE 28
#define MR_STR_CANTDECRYPT_MSG_BODY 29
#define MR_STR_FINGERPRINTS 30
#define MR_STR_READRCPT 31
#define MR_STR_READRCPT_MAILBODY 32
#define MR_STR_MSGGRPIMGDELETED 33
#define MR_STR_E2E_PREFERRED 34
#define MR_STR_ARCHIVEDCHATS 40
#define MR_STR_STARREDMSGS 41
#define MR_STR_AC_SETUP_MSG_SUBJECT 42
#define MR_STR_AC_SETUP_MSG_BODY 43
#define MR_STR_SELFTALK_SUBTITLE 50
#define DC_STR_FREE_ 0
#define DC_STR_NOMESSAGES 1
#define DC_STR_SELF 2
#define DC_STR_DRAFT 3
#define DC_STR_MEMBER 4
#define DC_STR_CONTACT 6
#define DC_STR_VOICEMESSAGE 7
#define DC_STR_DEADDROP 8
#define DC_STR_IMAGE 9
#define DC_STR_VIDEO 10
#define DC_STR_AUDIO 11
#define DC_STR_FILE 12
#define DC_STR_STATUSLINE 13
#define DC_STR_NEWGROUPDRAFT 14
#define DC_STR_MSGGRPNAME 15
#define DC_STR_MSGGRPIMGCHANGED 16
#define DC_STR_MSGADDMEMBER 17
#define DC_STR_MSGDELMEMBER 18
#define DC_STR_MSGGROUPLEFT 19
#define DC_STR_SELFNOTINGRP 21
#define DC_STR_NONETWORK 22
#define DC_STR_GIF 23
#define DC_STR_ENCRYPTEDMSG 24
#define DC_STR_E2E_AVAILABLE 25
#define DC_STR_ENCR_TRANSP 27
#define DC_STR_ENCR_NONE 28
#define DC_STR_CANTDECRYPT_MSG_BODY 29
#define DC_STR_FINGERPRINTS 30
#define DC_STR_READRCPT 31
#define DC_STR_READRCPT_MAILBODY 32
#define DC_STR_MSGGRPIMGDELETED 33
#define DC_STR_E2E_PREFERRED 34
#define DC_STR_ARCHIVEDCHATS 40
#define DC_STR_STARREDMSGS 41
#define DC_STR_AC_SETUP_MSG_SUBJECT 42
#define DC_STR_AC_SETUP_MSG_BODY 43
#define DC_STR_SELFTALK_SUBTITLE 50
/* should be set up by dc_context_new() */
@ -78,27 +78,27 @@ extern dc_context_t* s_localize_mb_obj;
/* Return the string with the given ID by calling DC_EVENT_GET_STRING.
The result must be free()'d! */
char* mrstock_str (int id);
char* dc_stock_str (int id);
/* Replaces the first `%1$s` in the given String-ID by the given value.
The result must be free()'d! */
char* mrstock_str_repl_string (int id, const char* value);
char* mrstock_str_repl_int (int id, int value);
char* dc_stock_str_repl_string (int id, const char* value);
char* dc_stock_str_repl_int (int id, int value);
/* Replaces the first `%1$s` and `%2$s` in the given String-ID by the two given strings.
The result must be free()'d! */
char* mrstock_str_repl_string2 (int id, const char*, const char*);
char* dc_stock_str_repl_string2 (int id, const char*, const char*);
/* Return a string with a correct plural form by callint DC_EVENT_GET_QUANTITY_STRING.
The result must be free()'d! */
char* mrstock_str_repl_pl (int id, int cnt);
char* dc_stock_str_repl_pl (int id, int cnt);
#ifdef __cplusplus
} /* /extern "C" */
#endif
#endif /* __MRSTOCK_H__ */
#endif /* __DC_STOCK_H__ */