parse READY event to get information for session

This commit is contained in:
2019-07-10 19:04:41 +02:00
parent d10f0b1f32
commit b6cffac1d9
10 changed files with 225 additions and 23 deletions

View File

@@ -46,7 +46,9 @@ dc_account_t dc_account_new2(char const *email, char const *pass);
dc_account_t dc_account_from_fullname(char const *fullid);
dc_account_t dc_account_from_json(json_t *j);
dc_account_t dc_account_from_relationship(json_t *j);
json_t *dc_account_to_json(dc_account_t a);
bool dc_account_load(dc_account_t a, json_t *j);
void dc_account_set_email(dc_account_t a, char const *email);
char const *dc_account_email(dc_account_t a);
@@ -76,6 +78,7 @@ bool dc_account_equal(dc_account_t a, dc_account_t b);
/* relationships
*/
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);
size_t dc_account_friends_size(dc_account_t a);
dc_account_t dc_account_findfriend(dc_account_t a, char const *fullname);

View File

@@ -56,6 +56,7 @@ 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);
size_t dc_channel_messages(dc_channel_t c);

View File

@@ -7,6 +7,13 @@
struct dc_event_;
typedef struct dc_event_ *dc_event_t;
typedef enum {
DC_EVENT_TYPE_UNKNOWN = 0,
DC_EVENT_TYPE_READY,
DC_EVENT_TYPE_LAST,
} dc_event_type_t;
dc_event_t dc_event_new(char const *type, json_t *payload);
/**
@@ -22,4 +29,9 @@ char const *dc_event_type(dc_event_t e);
*/
json_t *dc_event_payload(dc_event_t e);
/**
* Returns an integer code representing the given type string.
*/
dc_event_type_t dc_event_type_code(dc_event_t e);
#endif

View File

@@ -52,6 +52,19 @@ bool dc_session_has_token(dc_session_t s);
*/
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);
/**
* access to the internal channel cache
*/
void dc_session_add_channel(dc_session_t s, dc_channel_t u);
/**
* comparision functions for sorting, and finding
*/
bool dc_session_equal_me(dc_session_t s, dc_account_t a);
bool dc_session_equal_me_fullname(dc_session_t s, char const *a);