began work on guilds

This commit is contained in:
2019-06-25 18:20:27 +02:00
parent aed7dacf29
commit 523725f375
8 changed files with 150 additions and 39 deletions

View File

@@ -25,6 +25,8 @@ char const *dc_account_username(dc_account_t a);
void dc_account_set_discriminator(dc_account_t a, char const *id);
char const *dc_account_discriminator(dc_account_t a);
char const *dc_account_full_username(dc_account_t a);
void dc_account_set_token(dc_account_t a, char const *token);
char const *dc_account_token(dc_account_t a);
bool dc_account_has_token(dc_account_t a);

View File

@@ -25,13 +25,30 @@ void dc_api_signal(dc_api_t api, CURL *easy, int code);
/* internal curl stuff
*/
dc_api_sync_t dc_api_call(dc_api_t api, char const *token,
char const *method, json_t *j);
char const *verb, char const *method,
json_t *j);
json_t *dc_api_call_sync(dc_api_t api, char const *token,
char const *method, json_t *j);
char const *verb, char const *method,
json_t *j);
/**
* Authenticate a given user account. The user account should have
* email, and password set. If the auth succeeds the account will have
* a login token, and will from now on be the "login account". You
* will have to pass that account to various other functions for
* authentication.
*/
bool dc_api_authenticate(dc_api_t api, dc_account_t account);
bool dc_api_userinfo(dc_api_t api, dc_account_t logion,
dc_account_t user);
/**
* Retrieve basic user information for the given account. The first
* parameter is the user account holding login info, while the second
* is the account you wish to retrieve information about.
*/
bool dc_api_get_userinfo(dc_api_t api, dc_account_t login,
dc_account_t user);
bool dc_api_get_userguilds(dc_api_t api, dc_account_t login,
GPtrArray *guilds);
#endif

17
libdc/include/dc/guild.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef DC_GUILD_H
#define DC_GUILD_H
/* Discords version of groups or chat servers
*/
struct dc_guild_;
typedef struct dc_guild_ *dc_guild_t;
dc_guild_t dc_guild_new(void);
char const *dc_guild_name(dc_guild_t d);
void dc_guild_set_name(dc_guild_t d, char const *val);
char const *dc_guild_id(dc_guild_t d);
void dc_guild_set_id(dc_guild_t d, char const *val);
#endif