text stringlengths 0 357 |
|---|
if (chat==NULL || chat->magic!=DC_CHAT_MAGIC) { |
return 0; |
} |
return chat->archived; |
} |
/** |
* Check if a group chat is still unpromoted. |
* |
* After the creation with dc_create_group_chat() the chat is usually unpromoted |
* until the first call to dc_send_text_msg() or another sending function. |
* |
* With unpromoted chats, members can be added |
* and settings can be modified without the need of special status messages being sent. |
* |
* While the core takes care of the unpromoted state on its own, |
* checking the state from the UI side may be useful to decide whether a hint as |
* "Send the first message to allow others to reply within the group" |
* should be shown to the user or not. |
* |
* @memberof dc_chat_t |
* @param chat The chat object. |
* @return 1=chat is still unpromoted, no message was ever send to the chat, |
* 0=chat is not unpromoted, messages were send and/or received |
* or the chat is not group chat. |
*/ |
int dc_chat_is_unpromoted(const dc_chat_t* chat) |
{ |
if (chat==NULL || chat->magic!=DC_CHAT_MAGIC) { |
return 0; |
} |
return dc_param_get_int(chat->param, DC_PARAM_UNPROMOTED, 0); |
} |
/** |
* Check if a chat is verified. Verified chats contain only verified members |
* and encryption is alwasy enabled. Verified chats are created using |
* dc_create_group_chat() by setting the 'verified' parameter to true. |
* |
* @memberof dc_chat_t |
* @param chat The chat object. |
* @return 1=chat verified, 0=chat is not verified |
*/ |
int dc_chat_is_verified(const dc_chat_t* chat) |
{ |
if (chat==NULL || chat->magic!=DC_CHAT_MAGIC) { |
return 0; |
} |
return (chat->type==DC_CHAT_TYPE_VERIFIED_GROUP); |
} |
/** |
* Check if a chat is a self talk. Self talks are normal chats with |
* the only contact DC_CONTACT_ID_SELF. |
* |
* @memberof dc_chat_t |
* @param chat The chat object. |
* @return 1=chat is self talk, 0=chat is no self talk |
*/ |
int dc_chat_is_self_talk(const dc_chat_t* chat) |
{ |
if (chat==NULL || chat->magic!=DC_CHAT_MAGIC) { |
return 0; |
} |
return dc_param_exists(chat->param, DC_PARAM_SELFTALK); |
} |
/** |
* Check if locations are sent to the chat |
* at the time the object was created using dc_get_chat(). |
* To check if locations are sent to _any_ chat, |
* use dc_is_sending_locations_to_chat(). |
* |
* @memberof dc_chat_t |
* @param chat The chat object. |
* @return 1=locations are sent to chat, 0=no locations are sent to chat |
*/ |
int dc_chat_is_sending_locations(const dc_chat_t* chat) |
{ |
if (chat==NULL || chat->magic!=DC_CHAT_MAGIC) { |
return 0; |
} |
return chat->is_sending_locations; |
} |
int dc_chat_update_param(dc_chat_t* chat) |
{ |
int success = 0; |
sqlite3_stmt* stmt = dc_sqlite3_prepare(chat->context->sql, |
"UPDATE chats SET param=? WHERE id=?"); |
sqlite3_bind_text(stmt, 1, chat->param->packed, -1, SQLITE_STATIC); |
sqlite3_bind_int (stmt, 2, chat->id); |
success = (sqlite3_step(stmt)==SQLITE_DONE)? 1 : 0; |
sqlite3_finalize(stmt); |
return success; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.