1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-06 03:50:08 +02:00

rename 'normal chats' to 'single chats'

This commit is contained in:
B. Petersen 2018-04-21 13:59:34 +02:00
parent e12f347ac1
commit 06279a6f7b
5 changed files with 13 additions and 13 deletions

View file

@ -343,7 +343,7 @@ void stress_functions(mrmailbox_t* mailbox)
assert( strcmp("mdn_rcvd=" MR_STRINGIFY(MR_STATE_OUT_MDN_RCVD), "mdn_rcvd=28")==0 ); assert( strcmp("mdn_rcvd=" MR_STRINGIFY(MR_STATE_OUT_MDN_RCVD), "mdn_rcvd=28")==0 );
assert( strcmp("undefined=" MR_STRINGIFY(MR_CHAT_TYPE_UNDEFINED), "undefined=0")==0 ); assert( strcmp("undefined=" MR_STRINGIFY(MR_CHAT_TYPE_UNDEFINED), "undefined=0")==0 );
assert( strcmp("normal=" MR_STRINGIFY(MR_CHAT_TYPE_NORMAL), "normal=100")==0 ); assert( strcmp("single=" MR_STRINGIFY(MR_CHAT_TYPE_SINGLE), "single=100")==0 );
assert( strcmp("group=" MR_STRINGIFY(MR_CHAT_TYPE_GROUP), "group=120")==0 ); assert( strcmp("group=" MR_STRINGIFY(MR_CHAT_TYPE_GROUP), "group=120")==0 );
assert( strcmp("deaddrop=" MR_STRINGIFY(MR_CHAT_ID_DEADDROP), "deaddrop=1")==0 ); assert( strcmp("deaddrop=" MR_STRINGIFY(MR_CHAT_ID_DEADDROP), "deaddrop=1")==0 );

View file

@ -149,7 +149,7 @@ uint32_t mrchat_get_id(mrchat_t* chat)
* *
* Currently, there are two chat types: * Currently, there are two chat types:
* *
* - MR_CHAT_TYPE_NORMAL (100) - a normal chat is a chat with a single contact, * - MR_CHAT_TYPE_SINGLE (100) - a normal chat is a chat with a single contact,
* chats_contacts contains one record for the user. MR_CONTACT_ID_SELF * chats_contacts contains one record for the user. MR_CONTACT_ID_SELF
* (see mrcontact_t::m_id) is added _only_ for a self talk; in addition to * (see mrcontact_t::m_id) is added _only_ for a self talk; in addition to
* this, for self talks also the flag MRP_SELFTALK is set. * this, for self talks also the flag MRP_SELFTALK is set.
@ -166,7 +166,7 @@ uint32_t mrchat_get_id(mrchat_t* chat)
int mrchat_get_type(mrchat_t* chat) int mrchat_get_type(mrchat_t* chat)
{ {
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) { if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
return MR_CHAT_TYPE_NORMAL; return MR_CHAT_TYPE_UNDEFINED;
} }
return chat->m_type; return chat->m_type;
} }
@ -219,11 +219,11 @@ char* mrchat_get_subtitle(mrchat_t* chat)
return safe_strdup("Err"); return safe_strdup("Err");
} }
if( chat->m_type == MR_CHAT_TYPE_NORMAL && mrparam_exists(chat->m_param, MRP_SELFTALK) ) if( chat->m_type == MR_CHAT_TYPE_SINGLE && mrparam_exists(chat->m_param, MRP_SELFTALK) )
{ {
ret = mrstock_str(MR_STR_SELFTALK_SUBTITLE); ret = mrstock_str(MR_STR_SELFTALK_SUBTITLE);
} }
else if( chat->m_type == MR_CHAT_TYPE_NORMAL ) else if( chat->m_type == MR_CHAT_TYPE_SINGLE )
{ {
int r; int r;
mrsqlite3_lock(chat->m_mailbox->m_sql); mrsqlite3_lock(chat->m_mailbox->m_sql);

View file

@ -39,7 +39,7 @@ typedef struct _mrmailbox mrmailbox_t;
#define MR_CHAT_TYPE_UNDEFINED 0 #define MR_CHAT_TYPE_UNDEFINED 0
#define MR_CHAT_TYPE_NORMAL 100 #define MR_CHAT_TYPE_SINGLE 100
#define MR_CHAT_TYPE_GROUP 120 #define MR_CHAT_TYPE_GROUP 120

View file

@ -1761,7 +1761,7 @@ void mrmailbox_lookup_real_nchat_by_contact_id__(mrmailbox_t* mailbox, uint32_t
"SELECT c.id, c.blocked" "SELECT c.id, c.blocked"
" FROM chats c" " FROM chats c"
" INNER JOIN chats_contacts j ON c.id=j.chat_id" " INNER JOIN chats_contacts j ON c.id=j.chat_id"
" WHERE c.type=" MR_STRINGIFY(MR_CHAT_TYPE_NORMAL) " AND c.id>" MR_STRINGIFY(MR_CHAT_ID_LAST_SPECIAL) " AND j.contact_id=?;"); " WHERE c.type=" MR_STRINGIFY(MR_CHAT_TYPE_SINGLE) " AND c.id>" MR_STRINGIFY(MR_CHAT_ID_LAST_SPECIAL) " AND j.contact_id=?;");
sqlite3_bind_int(stmt, 1, contact_id); sqlite3_bind_int(stmt, 1, contact_id);
if( sqlite3_step(stmt) == SQLITE_ROW ) { if( sqlite3_step(stmt) == SQLITE_ROW ) {
@ -1807,7 +1807,7 @@ void mrmailbox_create_or_lookup_nchat_by_contact_id__(mrmailbox_t* mailbox, uint
chat_name = (contact->m_name&&contact->m_name[0])? contact->m_name : contact->m_addr; chat_name = (contact->m_name&&contact->m_name[0])? contact->m_name : contact->m_addr;
/* create chat record */ /* create chat record */
q = sqlite3_mprintf("INSERT INTO chats (type, name, param, blocked) VALUES(%i, %Q, %Q, %i)", MR_CHAT_TYPE_NORMAL, chat_name, 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); contact_id==MR_CONTACT_ID_SELF? "K=1" : "", create_blocked);
assert( MRP_SELFTALK == 'K' ); assert( MRP_SELFTALK == 'K' );
stmt = mrsqlite3_prepare_v2_(mailbox->m_sql, q); stmt = mrsqlite3_prepare_v2_(mailbox->m_sql, q);
@ -2257,7 +2257,7 @@ static uint32_t mrmailbox_send_msg_i__(mrmailbox_t* mailbox, mrchat_t* chat, con
free(from); free(from);
} }
if( chat->m_type == MR_CHAT_TYPE_NORMAL ) if( chat->m_type == MR_CHAT_TYPE_SINGLE )
{ {
stmt = mrsqlite3_predefine__(mailbox->m_sql, SELECT_c_FROM_chats_contacts_WHERE_c, stmt = mrsqlite3_predefine__(mailbox->m_sql, SELECT_c_FROM_chats_contacts_WHERE_c,
"SELECT contact_id FROM chats_contacts WHERE chat_id=?;"); "SELECT contact_id FROM chats_contacts WHERE chat_id=?;");
@ -3535,7 +3535,7 @@ uint32_t mrmailbox_add_or_lookup_contact__( mrmailbox_t* mailbox,
stmt = mrsqlite3_predefine__(mailbox->m_sql, UPDATE_chats_SET_n_WHERE_c, stmt = mrsqlite3_predefine__(mailbox->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=?);"); "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_text(stmt, 1, name, -1, SQLITE_STATIC);
sqlite3_bind_int (stmt, 2, MR_CHAT_TYPE_NORMAL); sqlite3_bind_int (stmt, 2, MR_CHAT_TYPE_SINGLE);
sqlite3_bind_int (stmt, 3, row_id); sqlite3_bind_int (stmt, 3, row_id);
sqlite3_step (stmt); sqlite3_step (stmt);
} }
@ -4038,7 +4038,7 @@ void mrmailbox_block_contact(mrmailbox_t* mailbox, uint32_t contact_id, int new_
stmt = mrsqlite3_predefine__(mailbox->m_sql, UPDATE_chats_SET_blocked_WHERE_contact_id, stmt = mrsqlite3_predefine__(mailbox->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=?);"); "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, 1, new_blocking);
sqlite3_bind_int(stmt, 2, MR_CHAT_TYPE_NORMAL); sqlite3_bind_int(stmt, 2, MR_CHAT_TYPE_SINGLE);
sqlite3_bind_int(stmt, 3, contact_id); sqlite3_bind_int(stmt, 3, contact_id);
if( sqlite3_step(stmt)!=SQLITE_DONE ) { if( sqlite3_step(stmt)!=SQLITE_DONE ) {
goto cleanup; goto cleanup;
@ -5151,7 +5151,7 @@ int mrmailbox_mdn_from_ext__(mrmailbox_t* mailbox, uint32_t from_id, const char*
} }
// Normal chat? that's quite easy. // Normal chat? that's quite easy.
if( chat_type == MR_CHAT_TYPE_NORMAL ) { if( chat_type == MR_CHAT_TYPE_SINGLE ) {
mrmailbox_update_msg_state__(mailbox, *ret_msg_id, MR_STATE_OUT_MDN_RCVD); mrmailbox_update_msg_state__(mailbox, *ret_msg_id, MR_STATE_OUT_MDN_RCVD);
return 1; /* send event about new state */ return 1; /* send event about new state */
} }

View file

@ -203,7 +203,7 @@ int mrsqlite3_open__(mrsqlite3_t* ths, const char* dbfile, int flags)
mrsqlite3_execute__(ths, "CREATE TABLE chats_contacts (chat_id INTEGER, contact_id INTEGER);"); mrsqlite3_execute__(ths, "CREATE TABLE chats_contacts (chat_id INTEGER, contact_id INTEGER);");
mrsqlite3_execute__(ths, "CREATE INDEX chats_contacts_index1 ON chats_contacts (chat_id);"); mrsqlite3_execute__(ths, "CREATE INDEX chats_contacts_index1 ON chats_contacts (chat_id);");
mrsqlite3_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');"); mrsqlite3_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_NORMAL) || MR_CHAT_TYPE_NORMAL!=100 || MR_CHAT_TYPE_GROUP!=120 || \ #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_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_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 MR_CHAT_NOT_BLOCKED!=0 || MR_CHAT_MANUALLY_BLOCKED!=1 || MR_CHAT_DEADDROP_BLOCKED!=2