revamp handling of channels

This commit is contained in:
2019-07-10 20:16:47 +02:00
parent 596969bbae
commit 6d7c7e641f
11 changed files with 151 additions and 42 deletions

View File

@@ -79,9 +79,9 @@ bool dc_account_equal(dc_account_t a, dc_account_t b);
*/
void dc_account_set_friends(dc_account_t a, dc_account_t *ptr, size_t len);
void dc_account_add_friend(dc_account_t a, dc_account_t friend);
dc_account_t dc_account_nthfriend(dc_account_t a, size_t i);
dc_account_t dc_account_nth_friend(dc_account_t a, size_t i);
size_t dc_account_friends_size(dc_account_t a);
dc_account_t dc_account_findfriend(dc_account_t a, char const *fullname);
dc_account_t dc_account_find_friend(dc_account_t a, char const *fullname);
int dc_account_friend_state(dc_account_t a);
void dc_account_set_friend_state(dc_account_t a, int state);

View File

@@ -56,11 +56,14 @@ dc_channel_type_t dc_channel_type(dc_channel_t c);
void dc_channel_set_type(dc_channel_t c, dc_channel_type_t t);
size_t dc_channel_recipients(dc_channel_t c);
void dc_channel_addrecipient(dc_channel_t c, dc_account_t a);
dc_account_t dc_channel_nthrecipient(dc_channel_t c, size_t i);
void dc_channel_add_recipient(dc_channel_t c, dc_account_t a);
dc_account_t dc_channel_nth_recipient(dc_channel_t c, size_t i);
bool dc_channel_has_recipient(dc_channel_t c, dc_account_t a);
size_t dc_channel_messages(dc_channel_t c);
dc_message_t dc_channel_nthmessage(dc_channel_t c, size_t i);
void dc_channel_addmessages(dc_channel_t c, dc_message_t *m, size_t s);
dc_message_t dc_channel_nth_message(dc_channel_t c, size_t i);
void dc_channel_add_messages(dc_channel_t c, dc_message_t *m, size_t s);
bool dc_channel_compare(dc_channel_t a, dc_channel_t b);
#endif

View File

@@ -56,12 +56,30 @@ dc_account_t dc_session_me(dc_session_t s);
* access to the internal account cache
*/
void dc_session_add_account(dc_session_t s, dc_account_t u);
dc_account_t dc_session_account_fullname(dc_session_t s, char const *f);
/**
* access to the internal channel cache
* Adds a new channel to the internal cache.
*/
void dc_session_add_channel(dc_session_t s, dc_channel_t u);
/**
* Creates a new channel, or returns an existing channel if a channel with
* these recipients already exists.
* Warning: You must dc_ref() the return object if you need it beyond the
* life-span of the session.
*/
dc_channel_t dc_session_make_channel(dc_session_t s, dc_account_t *r,
size_t n);
/**
* Finds a channel object by that match the given recipients.
* Warning: You must dc_ref() the return object if you need it beyond the
* life-span of the session.
*/
dc_channel_t dc_session_channel_recipients(dc_session_t s,
dc_account_t *r, size_t sz);
/**
* comparision functions for sorting, and finding
*/