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

add a function to render the Autocrypt-Gossip:-header

This commit is contained in:
B. Petersen 2018-01-07 02:10:34 +01:00
parent f37bbe12ae
commit 213bcc70e1
2 changed files with 18 additions and 0 deletions

View file

@ -160,6 +160,22 @@ void mrapeerstate_unref(mrapeerstate_t* ths)
}
char* mrapeerstate_render_gossip_header(mrapeerstate_t* peerstate)
{
char* ret = NULL;
mraheader_t* autocryptheader = mraheader_new();
autocryptheader->m_prefer_encrypt = MRA_PE_NOPREFERENCE; /* the spec says, we SHOULD NOT gossip this flag */
autocryptheader->m_addr = safe_strdup(peerstate->m_addr);
autocryptheader->m_public_key = mrkey_ref(peerstate->m_public_key);
ret = mraheader_render(autocryptheader);
mraheader_unref(autocryptheader);
return ret;
}
/*******************************************************************************
* Change state
******************************************************************************/

View file

@ -64,6 +64,8 @@ int mrapeerstate_init_from_header (mrapeerstate_t*, const mraheader
int mrapeerstate_degrade_encryption(mrapeerstate_t*, time_t message_time);
int mrapeerstate_apply_header (mrapeerstate_t*, const mraheader_t*, time_t message_time); /*returns 1 on changes*/
char* mrapeerstate_render_gossip_header(mrapeerstate_t*);
int mrapeerstate_load_from_db__ (mrapeerstate_t*, mrsqlite3_t*, const char* addr);
int mrapeerstate_save_to_db__ (const mrapeerstate_t*, mrsqlite3_t*, int create);