Work
FossilOrigin-Name: 4dad40a89c3a003bfda76a128f22df56bdab086313a822eee967add8d3a1820a
This commit is contained in:
parent
332291bf0a
commit
9df1e54cdf
27 changed files with 206 additions and 16 deletions
|
@ -103,11 +103,15 @@ MSTDNT_ACCOUNT_ACTION_DECL(unsubscribe);
|
|||
|
||||
int mstdnt_verify_credentials(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_account* acct,
|
||||
struct mstdnt_storage* storage);
|
||||
|
||||
int mstdnt_get_account(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
int lookup_type,
|
||||
char* id,
|
||||
struct mstdnt_account* acct,
|
||||
|
@ -115,6 +119,8 @@ int mstdnt_get_account(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_blocks(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_account_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_account* accts[],
|
||||
|
@ -122,6 +128,8 @@ int mstdnt_get_blocks(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_mutes(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_account_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_account* accts[],
|
||||
|
@ -129,6 +137,8 @@ int mstdnt_get_mutes(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_followers(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_account_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -137,6 +147,8 @@ int mstdnt_get_followers(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_following(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_account_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
|
|
@ -58,12 +58,16 @@ struct mstdnt_application_args
|
|||
|
||||
int mstdnt_register_app(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_application_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_app* app);
|
||||
|
||||
int mstdnt_obtain_oauth_token(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_application_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_oauth_token* app);
|
||||
|
|
|
@ -53,6 +53,8 @@ void _mstdnt_val_attachments_call(cJSON* v, void* _type);
|
|||
|
||||
int mstdnt_upload_media(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_upload_media_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_attachment* attachment);
|
||||
|
|
|
@ -60,6 +60,8 @@ int mstdnt_messages_json(struct mstdnt_message* message[], size_t* size, cJSON*
|
|||
|
||||
int mstdnt_get_chats_v2(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_chats_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_chat* chats[],
|
||||
|
@ -67,6 +69,8 @@ int mstdnt_get_chats_v2(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_chat_messages(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* chat_id,
|
||||
struct mstdnt_chats_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -75,6 +79,8 @@ int mstdnt_get_chat_messages(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_chat(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* chat_id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_chat* chat);
|
||||
|
|
|
@ -51,24 +51,32 @@ int mstdnt_lists_json(struct mstdnt_list* lists[],
|
|||
|
||||
int mstdnt_get_lists(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_list* lists[],
|
||||
size_t* size);
|
||||
|
||||
int mstdnt_get_list(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_list* lists);
|
||||
|
||||
int mstdnt_create_list(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_list_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_list* list);
|
||||
|
||||
int mstdnt_update_list(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_list_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -76,11 +84,15 @@ int mstdnt_update_list(mastodont_t* api,
|
|||
|
||||
int mstdnt_delete_list(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage);
|
||||
|
||||
int mstdnt_list_get_accounts(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_account_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -89,6 +101,8 @@ int mstdnt_list_get_accounts(mastodont_t* data,
|
|||
|
||||
int mstdnt_list_add_accounts(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
char** account_ids,
|
||||
size_t account_ids_len,
|
||||
|
@ -96,6 +110,8 @@ int mstdnt_list_add_accounts(mastodont_t* api,
|
|||
|
||||
int mstdnt_list_remove_accounts(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
char** account_ids,
|
||||
size_t account_ids_len,
|
||||
|
|
|
@ -73,6 +73,8 @@ int mstdnt_notification_pleroma_json(struct mstdnt_notification_pleroma* notif,
|
|||
|
||||
int mstdnt_get_notifications(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_notifications_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_notification** notifs,
|
||||
|
@ -80,16 +82,22 @@ int mstdnt_get_notifications(mastodont_t* data,
|
|||
|
||||
int mstdnt_notifications_clear(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_storage* storage);
|
||||
|
||||
int mstdnt_notifications_read(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_notifications_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_notification* notification);
|
||||
|
||||
int mstdnt_notification_dismiss(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_storage* storage,
|
||||
char* id);
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ struct mstdnt_request_args
|
|||
|
||||
int mstdnt_request(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_request_args* args);
|
||||
|
||||
#endif /* MASTODONT_REQUEST_H */
|
||||
|
|
|
@ -48,6 +48,8 @@ struct _mstdnt_scrobbles_cb_args
|
|||
|
||||
int mstdnt_get_scrobbles(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_get_scrobbles_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
|
|
@ -56,6 +56,8 @@ int mstdnt_search_json(struct mstdnt_search_results* search_results, cJSON* json
|
|||
|
||||
int mstdnt_search(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* query,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_search_args* args,
|
||||
|
|
|
@ -115,6 +115,8 @@ void mstdnt_cleanup_status(struct mstdnt_status* status);
|
|||
int mstdnt_status_json(struct mstdnt_status* status, cJSON* js);
|
||||
int mstdnt_status_emoji_react(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
char* emoji,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -136,6 +138,8 @@ int mstdnt_status_context_json(struct mstdnt_status* statuses_before[],
|
|||
|
||||
int mstdnt_get_account_statuses(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_account_statuses_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -144,12 +148,16 @@ int mstdnt_get_account_statuses(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_status(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* status);
|
||||
|
||||
int mstdnt_get_status_context(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses_before[],
|
||||
|
@ -165,6 +173,8 @@ int mstdnt_status_favourited_by(mastodont_t* data, struct mstdnt_args* args,
|
|||
|
||||
int mstdnt_status_reblogged_by(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_account* accounts[],
|
||||
|
@ -172,11 +182,15 @@ int mstdnt_status_reblogged_by(mastodont_t* data,
|
|||
|
||||
int mstdnt_create_status(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_status_args* args,
|
||||
struct mstdnt_storage* storage);
|
||||
|
||||
/* Generates do and undo functions */
|
||||
#define MSTDNT_STATUS_ACTION_DECL(type) int mstdnt_##type##_status(mastodont_t* data, struct mstdnt_args* m_args, char* id, struct mstdnt_storage* storage, struct mstdnt_status* status)
|
||||
#define MSTDNT_STATUS_ACTION_DECL(type) int mstdnt_##type##_status(mastodont_t* data, struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args, char* id, struct mstdnt_storage* storage, struct mstdnt_status* status)
|
||||
#define MSTDNT_STATUS_ACTION_FUNC_URL(action) { \
|
||||
return mstdnt_status_action(data, m_args, id, storage, status, "api/v1/statuses/%s/" action); \
|
||||
}
|
||||
|
@ -193,12 +207,16 @@ MSTDNT_STATUS_ACTION_DECL(delete);
|
|||
|
||||
int mstdnt_mute_conversation(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* status);
|
||||
|
||||
int mstdnt_unmute_conversation(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* status);
|
||||
|
@ -235,6 +253,8 @@ struct mstdnt_favourites_args
|
|||
|
||||
int mstdnt_get_bookmarks(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_bookmarks_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses[],
|
||||
|
@ -242,6 +262,8 @@ int mstdnt_get_bookmarks(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_favourites(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_favourites_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses[],
|
||||
|
|
|
@ -42,6 +42,8 @@ struct mstdnt_timeline_args
|
|||
|
||||
int mstdnt_timeline_home(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_timeline_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses[],
|
||||
|
@ -49,6 +51,8 @@ int mstdnt_timeline_home(mastodont_t* data,
|
|||
|
||||
int mstdnt_timeline_list(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* list_id,
|
||||
struct mstdnt_timeline_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -57,6 +61,8 @@ int mstdnt_timeline_list(mastodont_t* data,
|
|||
|
||||
int mstdnt_timeline_public(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_timeline_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses[],
|
||||
|
@ -64,6 +70,8 @@ int mstdnt_timeline_public(mastodont_t* data,
|
|||
|
||||
int mstdnt_timeline_direct(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_timeline_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses[],
|
||||
|
@ -71,6 +79,8 @@ int mstdnt_timeline_direct(mastodont_t* data,
|
|||
|
||||
int mstdnt_timeline_tag(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* hashtag,
|
||||
struct mstdnt_timeline_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
|
|
@ -27,6 +27,8 @@ typedef int8_t mstdnt_bool;
|
|||
#define MSTDNT_FALSE 1
|
||||
#define MSTDNT_BOOL_UNSET 0
|
||||
|
||||
typedef void (*mstdnt_request_cb_t)(void* data, void* args);
|
||||
|
||||
// It's more logical to not sanitize than to sanitize data
|
||||
#define MSTDNT_FLAG_NO_URI_SANITIZE (1<<0)
|
||||
#define MSTDNT_FLAG_SSL_UNVERIFIED (1<<1)
|
||||
|
|
|
@ -57,6 +57,8 @@ int mstdnt_accounts_json_callback(cJSON* json, void* _args)
|
|||
static int mstdnt_get_accounts_query(char* url,
|
||||
mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_account_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_account* accts[],
|
||||
|
@ -92,6 +94,8 @@ static int mstdnt_get_accounts_query(char* url,
|
|||
|
||||
int mstdnt_get_followers(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_account_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -105,6 +109,8 @@ int mstdnt_get_followers(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_following(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_account_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -117,6 +123,8 @@ int mstdnt_get_following(mastodont_t* data,
|
|||
}
|
||||
|
||||
int mstdnt_get_blocks(mastodont_t* data, struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_account_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_account* accts[],
|
||||
|
@ -126,6 +134,8 @@ int mstdnt_get_blocks(mastodont_t* data, struct mstdnt_args* m_args,
|
|||
}
|
||||
|
||||
int mstdnt_get_mutes(mastodont_t* data, struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_account_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_account* accts[],
|
||||
|
@ -136,6 +146,8 @@ int mstdnt_get_mutes(mastodont_t* data, struct mstdnt_args* m_args,
|
|||
|
||||
int mstdnt_get_account(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
int lookup, /* TODO move into separate function for consistancy? */
|
||||
char* id,
|
||||
struct mstdnt_account* acct,
|
||||
|
@ -163,6 +175,8 @@ int mstdnt_get_account(mastodont_t* data,
|
|||
|
||||
int mstdnt_verify_credentials(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_account* acct,
|
||||
struct mstdnt_storage* storage)
|
||||
{
|
||||
|
@ -225,6 +239,8 @@ int mstdnt_account_json(struct mstdnt_account* acct, cJSON* js)
|
|||
|
||||
int mstdnt_account_action(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_relationship* rel,
|
||||
|
|
|
@ -89,6 +89,8 @@ void _mstdnt_val_malloc_application_call(cJSON* v, void* _type)
|
|||
|
||||
int mstdnt_register_app(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_application_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_app* app)
|
||||
|
@ -116,6 +118,8 @@ int mstdnt_register_app(mastodont_t* data,
|
|||
|
||||
int mstdnt_obtain_oauth_token(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_application_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_oauth_token* token)
|
||||
|
|
|
@ -101,6 +101,8 @@ static int mstdnt_attachment_json_callback(cJSON* json, void* _args)
|
|||
|
||||
int mstdnt_upload_media(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_upload_media_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_attachment* attachment)
|
||||
|
@ -121,7 +123,7 @@ int mstdnt_upload_media(mastodont_t* api,
|
|||
mstdnt_attachment_json_callback,
|
||||
};
|
||||
|
||||
return mstdnt_request(api, m_args, &req_args);
|
||||
return mstdnt_request(api, m_args, &req_args, cb_request, cb_args);
|
||||
}
|
||||
|
||||
void mstdnt_cleanup_attachments(struct mstdnt_attachment* attachment)
|
||||
|
|
14
src/chats.c
14
src/chats.c
|
@ -107,6 +107,8 @@ static int mstdnt_messages_json_callback(cJSON* json, void* _args)
|
|||
|
||||
int mstdnt_get_chats_v2(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_chats_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_chat* chats[],
|
||||
|
@ -140,6 +142,8 @@ int mstdnt_get_chats_v2(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_chat_messages(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* chat_id,
|
||||
struct mstdnt_chats_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -176,10 +180,12 @@ int mstdnt_get_chat_messages(mastodont_t* data,
|
|||
}
|
||||
|
||||
int mstdnt_get_chat(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
char* chat_id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_chat* chat)
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* chat_id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_chat* chat)
|
||||
{
|
||||
char url[MSTDNT_URLSIZE];
|
||||
snprintf(url, MSTDNT_URLSIZE, "api/v1/pleroma/chats/%s", chat_id);
|
||||
|
|
|
@ -49,6 +49,8 @@ void mstdnt_fetch_results_cleanup(struct mstdnt_fetch_results* res)
|
|||
int mstdnt_fetch_curl(mastodont_t* mstdnt,
|
||||
CURL* curl,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* _url,
|
||||
struct mstdnt_fetch_results* results,
|
||||
CURLoption request_t,
|
||||
|
|
22
src/list.c
22
src/list.c
|
@ -75,6 +75,8 @@ static int mstdnt_lists_json_callback(cJSON* json, void* _args)
|
|||
|
||||
int mstdnt_get_lists(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_list* lists[],
|
||||
size_t* size)
|
||||
|
@ -100,6 +102,8 @@ int mstdnt_get_lists(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_list(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_list* list)
|
||||
|
@ -136,6 +140,8 @@ static const char* replies_policy_str(enum mstdnt_list_replies_policy pol)
|
|||
}
|
||||
|
||||
int mstdnt_create_list(mastodont_t* data, struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_list_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_list* list)
|
||||
|
@ -161,6 +167,8 @@ int mstdnt_create_list(mastodont_t* data, struct mstdnt_args* m_args,
|
|||
|
||||
int mstdnt_update_list(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_list_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -190,6 +198,8 @@ int mstdnt_update_list(mastodont_t* data,
|
|||
|
||||
int mstdnt_delete_list(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage)
|
||||
{
|
||||
|
@ -207,11 +217,13 @@ int mstdnt_delete_list(mastodont_t* api,
|
|||
NULL,
|
||||
};
|
||||
|
||||
return mstdnt_request(api, m_args, &req_args);
|
||||
return mstdnt_request(api, m_args, &req_args, cb_request, cb_args);
|
||||
}
|
||||
|
||||
int mstdnt_list_add_accounts(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
char** account_ids,
|
||||
size_t account_ids_len,
|
||||
|
@ -240,11 +252,13 @@ int mstdnt_list_add_accounts(mastodont_t* api,
|
|||
NULL,
|
||||
};
|
||||
|
||||
return mstdnt_request(api, m_args, &req_args);
|
||||
return mstdnt_request(api, m_args, &req_args, cb_request, cb_args);
|
||||
}
|
||||
|
||||
int mstdnt_list_remove_accounts(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
char** account_ids,
|
||||
size_t account_ids_len,
|
||||
|
@ -273,11 +287,13 @@ int mstdnt_list_remove_accounts(mastodont_t* api,
|
|||
NULL,
|
||||
};
|
||||
|
||||
return mstdnt_request(api, m_args, &req_args);
|
||||
return mstdnt_request(api, m_args, &req_args, cb_request, cb_args);
|
||||
}
|
||||
|
||||
int mstdnt_list_get_accounts(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_account_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
|
|
@ -97,6 +97,8 @@ int mstdnt_nodeinfo_json_callback(cJSON* json, void* nodeinfo)
|
|||
|
||||
int mstdnt_get_nodeinfo(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* version,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_nodeinfo* nodeinfo)
|
||||
|
@ -115,7 +117,7 @@ int mstdnt_get_nodeinfo(mastodont_t* api,
|
|||
mstdnt_nodeinfo_json_callback
|
||||
};
|
||||
|
||||
return mstdnt_request(api, m_args, &req_args);
|
||||
return mstdnt_request(api, m_args, &req_args, cb_request, cb_args);
|
||||
}
|
||||
|
||||
void mstdnt_cleanup_nodeinfo(struct mstdnt_nodeinfo* nodeinfo)
|
||||
|
|
|
@ -116,6 +116,8 @@ int mstdnt_notifications_json_callback(cJSON* json, void* _args)
|
|||
|
||||
int mstdnt_get_notifications(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_notifications_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_notification** notifs,
|
||||
|
@ -161,6 +163,8 @@ int mstdnt_get_notifications(mastodont_t* data,
|
|||
|
||||
int mstdnt_notification_dismiss(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_storage* storage,
|
||||
char* id)
|
||||
{
|
||||
|
@ -183,6 +187,8 @@ int mstdnt_notification_dismiss(mastodont_t* data,
|
|||
|
||||
int mstdnt_notifications_clear(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_storage* storage)
|
||||
{
|
||||
struct mstdnt_request_args req_args = {
|
||||
|
@ -201,6 +207,8 @@ int mstdnt_notifications_clear(mastodont_t* data,
|
|||
|
||||
int mstdnt_notifications_read(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_notifications_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_notification* notification)
|
||||
|
|
|
@ -98,6 +98,8 @@ int mstdnt_relationships_json_callback(cJSON* json, void* _args)
|
|||
}
|
||||
|
||||
int mstdnt_get_relationships(mastodont_t* data, struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char** ids,
|
||||
size_t ids_len,
|
||||
struct mstdnt_storage* storage,
|
||||
|
|
|
@ -73,6 +73,8 @@ static void mime_params_post(curl_mime* mime,
|
|||
|
||||
int mstdnt_request(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_request_args* args)
|
||||
{
|
||||
int res = 0, curlerror = 0;
|
||||
|
|
|
@ -54,6 +54,8 @@ int mstdnt_scrobbles_json_callback(cJSON* json, void* _args)
|
|||
|
||||
int mstdnt_get_scrobbles(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_get_scrobbles_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
|
|
@ -63,6 +63,8 @@ int mstdnt_search_json_callback(cJSON* json, void* _args)
|
|||
|
||||
int mstdnt_search(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* query,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_search_args* args,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
int mstdnt_instance_panel(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_fetch_results* html)
|
||||
{
|
||||
CURL* curl = curl_easy_init();
|
||||
|
@ -34,6 +36,8 @@ int mstdnt_instance_panel(mastodont_t* api,
|
|||
|
||||
int mstdnt_terms_of_service(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_fetch_results* html)
|
||||
{
|
||||
CURL* curl = curl_easy_init();
|
||||
|
|
26
src/status.c
26
src/status.c
|
@ -147,6 +147,8 @@ int mstdnt_statuses_json_callback(cJSON* json, void* _args)
|
|||
|
||||
int mstdnt_get_account_statuses(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_account_statuses_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -188,6 +190,8 @@ int mstdnt_get_account_statuses(mastodont_t* data,
|
|||
/* TODO Populate the arguments! */
|
||||
int mstdnt_create_status(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_status_args* args,
|
||||
struct mstdnt_storage* storage)
|
||||
{
|
||||
|
@ -221,6 +225,8 @@ int mstdnt_create_status(mastodont_t* data,
|
|||
|
||||
static int mstdnt_status_action(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* status,
|
||||
|
@ -291,6 +297,8 @@ MSTDNT_STATUS_ACTION_DECL(delete)
|
|||
/* TODO Mutes can be timed */
|
||||
int mstdnt_mute_conversation(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* status)
|
||||
|
@ -300,6 +308,8 @@ int mstdnt_mute_conversation(mastodont_t* data,
|
|||
|
||||
int mstdnt_unmute_conversation(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* status)
|
||||
|
@ -309,6 +319,8 @@ int mstdnt_unmute_conversation(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_status(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* status)
|
||||
|
@ -391,6 +403,8 @@ int mstdnt_status_context_json_callback(cJSON* json, void* _args)
|
|||
|
||||
int mstdnt_get_status_context(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses_before[],
|
||||
|
@ -423,6 +437,8 @@ int mstdnt_get_status_context(mastodont_t* data,
|
|||
|
||||
int mstdnt_status_favourited_by(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_account* accounts[],
|
||||
|
@ -451,6 +467,8 @@ int mstdnt_status_favourited_by(mastodont_t* data,
|
|||
|
||||
int mstdnt_status_reblogged_by(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_account* accounts[],
|
||||
|
@ -480,6 +498,8 @@ int mstdnt_status_reblogged_by(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_bookmarks(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_bookmarks_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses[],
|
||||
|
@ -510,6 +530,8 @@ int mstdnt_get_bookmarks(mastodont_t* data,
|
|||
|
||||
int mstdnt_get_favourites(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_favourites_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses[],
|
||||
|
@ -539,6 +561,8 @@ int mstdnt_get_favourites(mastodont_t* data,
|
|||
|
||||
int mstdnt_status_emoji_react(mastodont_t* api,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* id,
|
||||
char* emoji,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -558,7 +582,7 @@ int mstdnt_status_emoji_react(mastodont_t* api,
|
|||
mstdnt_status_json_callback
|
||||
};
|
||||
|
||||
return mstdnt_request(api, m_args, &req_args);
|
||||
return mstdnt_request(api, m_args, &req_args, cb_request, cb_args);
|
||||
}
|
||||
|
||||
void mstdnt_cleanup_status(struct mstdnt_status* status)
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
int mstdnt_timeline_list(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* list_id,
|
||||
struct mstdnt_timeline_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -56,11 +58,13 @@ int mstdnt_timeline_list(mastodont_t* data,
|
|||
mstdnt_statuses_json_callback,
|
||||
};
|
||||
|
||||
return mstdnt_request(data, m_args, &req_args);
|
||||
return mstdnt_request(data, m_args, &req_args, cb_request, cb_args);
|
||||
}
|
||||
|
||||
int mstdnt_timeline_tag(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
char* hashtag,
|
||||
struct mstdnt_timeline_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
|
@ -98,7 +102,7 @@ int mstdnt_timeline_tag(mastodont_t* data,
|
|||
mstdnt_statuses_json_callback,
|
||||
};
|
||||
|
||||
return mstdnt_request(data, m_args, &req_args);
|
||||
return mstdnt_request(data, m_args, &req_args, cb_request, cb_args);
|
||||
}
|
||||
|
||||
static const char* reply_visibility_str(enum mstdnt_reply_visibility vis)
|
||||
|
@ -117,6 +121,8 @@ static const char* reply_visibility_str(enum mstdnt_reply_visibility vis)
|
|||
|
||||
int mstdnt_timeline_public(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_timeline_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses[],
|
||||
|
@ -148,12 +154,14 @@ int mstdnt_timeline_public(mastodont_t* data,
|
|||
mstdnt_statuses_json_callback,
|
||||
};
|
||||
|
||||
return mstdnt_request(data, m_args, &req_args);
|
||||
return mstdnt_request(data, m_args, &req_args, cb_request, cb_args);
|
||||
}
|
||||
|
||||
|
||||
int mstdnt_timeline_direct(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_timeline_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses[],
|
||||
|
@ -181,12 +189,14 @@ int mstdnt_timeline_direct(mastodont_t* data,
|
|||
mstdnt_statuses_json_callback,
|
||||
};
|
||||
|
||||
return mstdnt_request(data, m_args, &req_args);
|
||||
return mstdnt_request(data, m_args, &req_args, cb_request, cb_args);
|
||||
}
|
||||
|
||||
|
||||
int mstdnt_timeline_home(mastodont_t* data,
|
||||
struct mstdnt_args* m_args,
|
||||
mstdnt_request_cb_t cb_request,
|
||||
void* cb_args,
|
||||
struct mstdnt_timeline_args* args,
|
||||
struct mstdnt_storage* storage,
|
||||
struct mstdnt_status* statuses[],
|
||||
|
@ -219,6 +229,6 @@ int mstdnt_timeline_home(mastodont_t* data,
|
|||
mstdnt_statuses_json_callback,
|
||||
};
|
||||
|
||||
return mstdnt_request(data, m_args, &req_args);
|
||||
return mstdnt_request(data, m_args, &req_args, cb_request, cb_args);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue