Rename docs for consistancy

FossilOrigin-Name: 8eb8d0b20477dd8df24fea4fac37cdd47b6c5412c134749c43d1da7412feb633
This commit is contained in:
nekobit 2022-10-14 13:32:05 +00:00
parent e72613093e
commit 0ff56024de
39 changed files with 225 additions and 225 deletions

View File

@ -30,27 +30,27 @@
#include <mastodont_chats.h>
//! Initializes libcurl
void mastodont_global_curl_init();
void mstdnt_global_curl_init();
//! Cleans up libcurl
void mastodont_global_curl_cleanup();
void mstdnt_global_curl_cleanup();
/*!
* Initializes a mastodont struct
* Initializes a mstdnt struct
*
* \param data Pointer to struct to fill in
* \return Value of curl_easy_init(); either Zero or non-zero
*/
int mastodont_init(mastodont_t* data);
int mstdnt_init(mstdnt_t* data);
/*!
* Cleans up the mastodont struct
* Cleans up the mstdnt struct
*
* \param data Pointer to the mastodont data
* \param data Pointer to the mstdnt data
*/
void mastodont_cleanup(mastodont_t* data);
void mstdnt_cleanup(mstdnt_t* data);
//! Call's free() or a library derivative
void mastodont_free(void*);
void mstdnt_free(void*);
/*!
* Cleans up a storage struct.
@ -59,6 +59,6 @@ void mastodont_free(void*);
*
* \param storage The storage block to cleanup
*/
void mastodont_storage_cleanup(struct mstdnt_storage* storage);
void mstdnt_storage_cleanup(struct mstdnt_storage* storage);
#endif /* MASTODONT_H */

View File

@ -73,10 +73,10 @@ struct mstdnt_account_args
char* since_id;
int offset;
int limit;
int with_relationships; // mastodont_get_mutes
int with_relationships; // mstdnt_get_mutes
};
int mstdnt_account_action(mastodont_t* data,
int mstdnt_account_action(mstdnt_t* data,
struct mstdnt_args* args,
char* id,
struct mstdnt_storage* storage,
@ -87,7 +87,7 @@ int mstdnt_accounts_json(struct mstdnt_account* accounts[],
size_t* size,
cJSON* js);
#define MSTDNT_ACCOUNT_ACTION_DECL(type) int mastodont_##type##_account(mastodont_t* data, struct mstdnt_args* args, char* id, struct mstdnt_storage* storage, struct mstdnt_relationship* relationship)
#define MSTDNT_ACCOUNT_ACTION_DECL(type) int mstdnt_##type##_account(mstdnt_t* data, struct mstdnt_args* args, char* id, struct mstdnt_storage* storage, struct mstdnt_relationship* relationship)
#define MSTDNT_ACCOUNT_ACTION_FUNC_URL(action) { \
return mstdnt_account_action(data, args, id, storage, relationship, "api/v1/accounts/%s/" action); \
}
@ -101,33 +101,33 @@ MSTDNT_ACCOUNT_ACTION_DECL(unblock);
MSTDNT_ACCOUNT_ACTION_DECL(subscribe);
MSTDNT_ACCOUNT_ACTION_DECL(unsubscribe);
int mastodont_verify_credentials(mastodont_t* data,
int mstdnt_verify_credentials(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_account* acct,
struct mstdnt_storage* storage);
int mastodont_get_account(mastodont_t* data,
int mstdnt_get_account(mstdnt_t* data,
struct mstdnt_args* m_args,
int lookup_type,
char* id,
struct mstdnt_account* acct,
struct mstdnt_storage* storage);
int mastodont_get_blocks(mastodont_t* data,
int mstdnt_get_blocks(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
struct mstdnt_account* accts[],
size_t* accts_len);
int mastodont_get_mutes(mastodont_t* data,
int mstdnt_get_mutes(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
struct mstdnt_account* accts[],
size_t* accts_len);
int mastodont_get_followers(mastodont_t* data,
int mstdnt_get_followers(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_account_args* args,
@ -135,7 +135,7 @@ int mastodont_get_followers(mastodont_t* data,
struct mstdnt_account* accts[],
size_t* accts_len);
int mastodont_get_following(mastodont_t* data,
int mstdnt_get_following(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_account_args* args,

View File

@ -56,13 +56,13 @@ struct mstdnt_application_args
char* website;
};
int mastodont_register_app(mastodont_t* data,
int mstdnt_register_app(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_application_args* args,
struct mstdnt_storage* storage,
struct mstdnt_app* app);
int mastodont_obtain_oauth_token(mastodont_t* data,
int mstdnt_obtain_oauth_token(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_application_args* args,
struct mstdnt_storage* storage,

View File

@ -51,7 +51,7 @@ int mstdnt_attachment_json(cJSON* att_json, struct mstdnt_attachment* att);
void _mstdnt_val_attachments_call(cJSON* v, void* _type);
int mastodont_upload_media(mastodont_t* api,
int mstdnt_upload_media(mstdnt_t* api,
struct mstdnt_args* m_args,
struct mstdnt_upload_media_args* args,
struct mstdnt_storage* storage,

View File

@ -58,14 +58,14 @@ int mstdnt_message_json(struct mstdnt_message* message, cJSON* js);
int mstdnt_message_json_callback(cJSON* json, void* chat);
int mstdnt_messages_json(struct mstdnt_message* message[], size_t* size, cJSON* js);
int mastodont_get_chats_v2(mastodont_t* data,
int mstdnt_get_chats_v2(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_chats_args* args,
struct mstdnt_storage* storage,
struct mstdnt_chat* chats[],
size_t* chats_len);
int mastodont_get_chat_messages(mastodont_t* data,
int mstdnt_get_chat_messages(mstdnt_t* data,
struct mstdnt_args* m_args,
char* chat_id,
struct mstdnt_chats_args* args,
@ -73,7 +73,7 @@ int mastodont_get_chat_messages(mastodont_t* data,
struct mstdnt_message* chats[],
size_t* size);
int mastodont_get_chat(mastodont_t* data,
int mstdnt_get_chat(mstdnt_t* data,
struct mstdnt_args* m_args,
char* chat_id,
struct mstdnt_storage* storage,

View File

@ -26,8 +26,8 @@ struct mstdnt_fetch_results
};
size_t mstdnt_curl_write_callback(char* ptr, size_t _size, size_t nmemb, void* _content);
void mastodont_fetch_results_cleanup(struct mstdnt_fetch_results* res);
int mastodont_fetch_curl(mastodont_t* mstdnt,
void mstdnt_fetch_results_cleanup(struct mstdnt_fetch_results* res);
int mstdnt_fetch_curl(mstdnt_t* mstdnt,
CURL* curl,
struct mstdnt_args* args,
char* url,

View File

@ -23,7 +23,7 @@ struct mstdnt_instance
};
// TODO
int mastodont_instance(mastodont_t* api, struct mstdnt_args* args,
int mstdnt_instance(mstdnt_t* api, struct mstdnt_args* args,
struct mstdnt_instance* inst);
#endif /* MASTODONT_INSTANCE_H */

View File

@ -49,37 +49,37 @@ int mstdnt_lists_json(struct mstdnt_list* lists[],
size_t* size,
cJSON* json);
int mastodont_get_lists(mastodont_t* api,
int mstdnt_get_lists(mstdnt_t* api,
struct mstdnt_args* m_args,
struct mstdnt_storage* storage,
struct mstdnt_list* lists[],
size_t* size);
int mastodont_get_list(mastodont_t* api,
int mstdnt_get_list(mstdnt_t* api,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_list* lists);
int mastodont_create_list(mastodont_t* api,
int mstdnt_create_list(mstdnt_t* api,
struct mstdnt_args* m_args,
struct mstdnt_list_args* args,
struct mstdnt_storage* storage,
struct mstdnt_list* list);
int mastodont_update_list(mastodont_t* api,
int mstdnt_update_list(mstdnt_t* api,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_list_args* args,
struct mstdnt_storage* storage,
struct mstdnt_list* list);
int mastodont_delete_list(mastodont_t* api,
int mstdnt_delete_list(mstdnt_t* api,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage);
int mastodont_list_get_accounts(mastodont_t* data,
int mstdnt_list_get_accounts(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_account_args* args,
@ -87,14 +87,14 @@ int mastodont_list_get_accounts(mastodont_t* data,
struct mstdnt_account* accts[],
size_t* accts_len);
int mastodont_list_add_accounts(mastodont_t* api,
int mstdnt_list_add_accounts(mstdnt_t* api,
struct mstdnt_args* m_args,
char* id,
char** account_ids,
size_t account_ids_len,
struct mstdnt_storage* storage);
int mastodont_list_remove_accounts(mastodont_t* api,
int mstdnt_list_remove_accounts(mstdnt_t* api,
struct mstdnt_args* m_args,
char* id,
char** account_ids,

View File

@ -41,7 +41,7 @@ int mstdnt_nodeinfo_json(struct mstdnt_nodeinfo* nodeinfo, cJSON* js);
int mstdnt_nodeinfo_json_callback(cJSON* json, void* nodeinfo);
int mastodont_get_nodeinfo(mastodont_t* api, struct mstdnt_args* args,
int mstdnt_get_nodeinfo(mstdnt_t* api, struct mstdnt_args* args,
char* version,
struct mstdnt_storage* storage,
struct mstdnt_nodeinfo* nodeinfo);

View File

@ -71,24 +71,24 @@ int mstdnt_notifications_json_callback(cJSON* json, void* _args);
int mstdnt_notification_json(struct mstdnt_notification* notif, cJSON* js);
int mstdnt_notification_pleroma_json(struct mstdnt_notification_pleroma* notif, cJSON* js);
int mastodont_get_notifications(mastodont_t* data,
int mstdnt_get_notifications(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_notifications_args* args,
struct mstdnt_storage* storage,
struct mstdnt_notification** notifs,
size_t* size);
int mastodont_notifications_clear(mastodont_t* data,
int mstdnt_notifications_clear(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_storage* storage);
int mastodont_notifications_read(mastodont_t* data,
int mstdnt_notifications_read(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_notifications_args* args,
struct mstdnt_storage* storage,
struct mstdnt_notification* notification);
int mastodont_notification_dismiss(mastodont_t* data,
int mstdnt_notification_dismiss(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_storage* storage,
char* id);

View File

@ -46,7 +46,7 @@ struct _mstdnt_query_param
} value;
};
char* _mstdnt_query_string(mastodont_t* data,
char* _mstdnt_query_string(mstdnt_t* data,
struct mstdnt_args* args,
char* src,
struct _mstdnt_query_param* params,

View File

@ -52,7 +52,7 @@ int mstdnt_relationships_json(struct mstdnt_relationship* relationships[],
int mstdnt_relationships_json_callback(cJSON* json, void* _args);
int mastodont_get_relationships(mastodont_t* data, struct mstdnt_args* args,
int mstdnt_get_relationships(mstdnt_t* data, struct mstdnt_args* args,
char** ids,
size_t ids_len,
struct mstdnt_storage* storage,

View File

@ -20,7 +20,7 @@
#include "mastodont_fetch.h"
#include "mastodont_query.h"
struct mastodont_request_args
struct mstdnt_request_args
{
struct mstdnt_storage* storage;
char* url;
@ -34,8 +34,8 @@ struct mastodont_request_args
int (*callback)(cJSON*, void*);
};
int mastodont_request(mastodont_t* data,
int mstdnt_request(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mastodont_request_args* args);
struct mstdnt_request_args* args);
#endif /* MASTODONT_REQUEST_H */

View File

@ -46,7 +46,7 @@ struct _mstdnt_scrobbles_cb_args
size_t* size;
};
int mastodont_get_scrobbles(mastodont_t* data,
int mstdnt_get_scrobbles(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_get_scrobbles_args* args,

View File

@ -54,7 +54,7 @@ int mstdnt_search_json_callback(cJSON* json, void* _args);
int mstdnt_search_json(struct mstdnt_search_results* search_results, cJSON* json);
int mastodont_search(mastodont_t* data,
int mstdnt_search(mstdnt_t* data,
struct mstdnt_args* m_args,
char* query,
struct mstdnt_storage* storage,

View File

@ -18,11 +18,11 @@
#include "mastodont_types.h"
#include "mastodont_fetch.h"
int mastodont_instance_panel(mastodont_t* api,
int mstdnt_instance_panel(mstdnt_t* api,
struct mstdnt_args* args,
struct mstdnt_fetch_results* html);
int mastodont_terms_of_service(mastodont_t* api,
int mstdnt_terms_of_service(mstdnt_t* api,
struct mstdnt_args* args,
struct mstdnt_fetch_results* html);

View File

@ -113,7 +113,7 @@ void mstdnt_cleanup_statuses(struct mstdnt_status* statuses, size_t s);
void mstdnt_cleanup_status(struct mstdnt_status* status);
int mstdnt_status_json(struct mstdnt_status* status, cJSON* js);
int mastodont_status_emoji_react(mastodont_t* api,
int mstdnt_status_emoji_react(mstdnt_t* api,
struct mstdnt_args* m_args,
char* id,
char* emoji,
@ -134,7 +134,7 @@ int mstdnt_status_context_json(struct mstdnt_status* statuses_before[],
size_t* size_after,
cJSON* js);
int mastodont_get_account_statuses(mastodont_t* data,
int mstdnt_get_account_statuses(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_account_statuses_args* args,
@ -142,13 +142,13 @@ int mastodont_get_account_statuses(mastodont_t* data,
struct mstdnt_status* statuses[],
size_t* size);
int mastodont_get_status(mastodont_t* data,
int mstdnt_get_status(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_status* status);
int mastodont_get_status_context(mastodont_t* data,
int mstdnt_get_status_context(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
@ -157,26 +157,26 @@ int mastodont_get_status_context(mastodont_t* data,
size_t* size_before,
size_t* size_after);
int mastodont_status_favourited_by(mastodont_t* data, struct mstdnt_args* args,
int mstdnt_status_favourited_by(mstdnt_t* data, struct mstdnt_args* args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_account* accounts[],
size_t* accts);
int mastodont_status_reblogged_by(mastodont_t* data,
int mstdnt_status_reblogged_by(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_account* accounts[],
size_t* accts);
int mastodont_create_status(mastodont_t* data,
int mstdnt_create_status(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_status_args* args,
struct mstdnt_storage* storage);
/* Generates do and undo functions */
#define MSTDNT_STATUS_ACTION_DECL(type) int mastodont_##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(mstdnt_t* data, struct mstdnt_args* m_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); \
}
@ -191,13 +191,13 @@ MSTDNT_STATUS_ACTION_DECL(bookmark);
MSTDNT_STATUS_ACTION_DECL(unbookmark);
MSTDNT_STATUS_ACTION_DECL(delete);
int mastodont_mute_conversation(mastodont_t* data,
int mstdnt_mute_conversation(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
struct mstdnt_status* status);
int mastodont_unmute_conversation(mastodont_t* data,
int mstdnt_unmute_conversation(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
@ -233,14 +233,14 @@ struct mstdnt_favourites_args
int limit;
};
int mastodont_get_bookmarks(mastodont_t* data,
int mstdnt_get_bookmarks(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_bookmarks_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* size);
int mastodont_get_favourites(mastodont_t* data,
int mstdnt_get_favourites(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_favourites_args* args,
struct mstdnt_storage* storage,

View File

@ -40,14 +40,14 @@ struct mstdnt_timeline_args
int with_muted;
};
int mastodont_timeline_home(mastodont_t* data,
int mstdnt_timeline_home(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* size);
int mastodont_timeline_list(mastodont_t* data,
int mstdnt_timeline_list(mstdnt_t* data,
struct mstdnt_args* m_args,
char* list_id,
struct mstdnt_timeline_args* args,
@ -55,21 +55,21 @@ int mastodont_timeline_list(mastodont_t* data,
struct mstdnt_status* statuses[],
size_t* size);
int mastodont_timeline_public(mastodont_t* data,
int mstdnt_timeline_public(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* statuses_size);
int mastodont_timeline_direct(mastodont_t* data,
int mstdnt_timeline_direct(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
struct mstdnt_status* statuses[],
size_t* statuses_size);
int mastodont_timeline_tag(mastodont_t* data,
int mstdnt_timeline_tag(mstdnt_t* data,
struct mstdnt_args* m_args,
char* hashtag,
struct mstdnt_timeline_args* args,

View File

@ -33,10 +33,10 @@ typedef int8_t mstdnt_bool;
#define MSTDNT_FLAG_ISSET(flags, flag) (((flags) & (flag)) == (flag))
#define MSTDNT_T_FLAG_ISSET(flag_ref, flag) (((flag_ref->flags) & (flag)) == (flag))
typedef struct mastodont
typedef struct mstdnt
{
CURLM* curl;
} mastodont_t;
} mstdnt_t;
struct mstdnt_storage
{

View File

@ -25,6 +25,6 @@ struct mstdnt_uri
char storage[MSTDNT_URISIZE];
};
struct mstdnt_uri mastodont_uristr_to_uri(char* uri, size_t len);
struct mstdnt_uri mstdnt_uristr_to_uri(char* uri, size_t len);
#endif /* MASTODONT_URI_H */

View File

@ -53,8 +53,8 @@ int mstdnt_accounts_json_callback(cJSON* json, void* _args)
return mstdnt_accounts_json(args->acct, args->size, json);
}
static int mastodont_get_accounts_query(char* url,
mastodont_t* data,
static int mstdnt_get_accounts_query(char* url,
mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
@ -75,7 +75,7 @@ static int mastodont_get_accounts_query(char* url,
{ _MSTDNT_QUERY_INT, "with_relationships", { .i = args->with_relationships } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
params, _mstdnt_arr_len(params),
@ -86,10 +86,10 @@ static int mastodont_get_accounts_query(char* url,
mstdnt_accounts_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_get_followers(mastodont_t* data,
int mstdnt_get_followers(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_account_args* args,
@ -99,10 +99,10 @@ int mastodont_get_followers(mastodont_t* data,
{
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, "api/v1/accounts/%s/followers", id);
return mastodont_get_accounts_query(url, data, m_args, args, storage, accts, accts_len);
return mstdnt_get_accounts_query(url, data, m_args, args, storage, accts, accts_len);
}
int mastodont_get_following(mastodont_t* data,
int mstdnt_get_following(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_account_args* args,
@ -112,28 +112,28 @@ int mastodont_get_following(mastodont_t* data,
{
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, "api/v1/accounts/%s/following", id);
return mastodont_get_accounts_query(url, data, m_args, args, storage, accts, accts_len);
return mstdnt_get_accounts_query(url, data, m_args, args, storage, accts, accts_len);
}
int mastodont_get_blocks(mastodont_t* data, struct mstdnt_args* m_args,
int mstdnt_get_blocks(mstdnt_t* data, struct mstdnt_args* m_args,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
struct mstdnt_account* accts[],
size_t* accts_len)
{
return mastodont_get_accounts_query("api/v1/blocks", data, m_args, args, storage, accts, accts_len);
return mstdnt_get_accounts_query("api/v1/blocks", data, m_args, args, storage, accts, accts_len);
}
int mastodont_get_mutes(mastodont_t* data, struct mstdnt_args* m_args,
int mstdnt_get_mutes(mstdnt_t* data, struct mstdnt_args* m_args,
struct mstdnt_account_args* args,
struct mstdnt_storage* storage,
struct mstdnt_account* accts[],
size_t* accts_len)
{
return mastodont_get_accounts_query("api/v1/mutes", data, m_args, args, storage, accts, accts_len);
return mstdnt_get_accounts_query("api/v1/mutes", data, m_args, args, storage, accts, accts_len);
}
int mastodont_get_account(mastodont_t* data,
int mstdnt_get_account(mstdnt_t* data,
struct mstdnt_args* m_args,
int lookup, /* TODO move into separate function for consistancy? */
char* id,
@ -146,7 +146,7 @@ int mastodont_get_account(mastodont_t* data,
lookup ? "api/v1/accounts/%s" : "api/v1/accounts/lookup?acct=%s",
id);
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -157,15 +157,15 @@ int mastodont_get_account(mastodont_t* data,
mstdnt_account_json_callback, /* callback */
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_verify_credentials(mastodont_t* data,
int mstdnt_verify_credentials(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_account* acct,
struct mstdnt_storage* storage)
{
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/accounts/verify_credentials",
NULL, 0,
@ -176,7 +176,7 @@ int mastodont_verify_credentials(mastodont_t* data,
mstdnt_account_json_callback, /* callback */
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mstdnt_account_json(struct mstdnt_account* acct, cJSON* js)
@ -222,7 +222,7 @@ int mstdnt_account_json(struct mstdnt_account* acct, cJSON* js)
}
int mstdnt_account_action(mastodont_t* data,
int mstdnt_account_action(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
@ -232,7 +232,7 @@ int mstdnt_account_action(mastodont_t* data,
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, url_str, id);
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -243,7 +243,7 @@ int mstdnt_account_action(mastodont_t* data,
mstdnt_relationship_json_callback
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
/* These are all the same */

View File

@ -86,7 +86,7 @@ void _mstdnt_val_malloc_application_call(cJSON* v, void* _type)
mstdnt_app_json(v->child, *type);
}
int mastodont_register_app(mastodont_t* data,
int mstdnt_register_app(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_application_args* args,
struct mstdnt_storage* storage,
@ -99,7 +99,7 @@ int mastodont_register_app(mastodont_t* data,
{ _MSTDNT_QUERY_STRING, "website", { .s = args->website } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/apps",
NULL, 0,
@ -110,10 +110,10 @@ int mastodont_register_app(mastodont_t* data,
mstdnt_app_json_callback
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_obtain_oauth_token(mastodont_t* data,
int mstdnt_obtain_oauth_token(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_application_args* args,
struct mstdnt_storage* storage,
@ -130,7 +130,7 @@ int mastodont_obtain_oauth_token(mastodont_t* data,
{ _MSTDNT_QUERY_STRING, "password", { .s = args->password } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"oauth/token",
NULL,
@ -143,6 +143,6 @@ int mastodont_obtain_oauth_token(mastodont_t* data,
mstdnt_token_json_callback
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}

View File

@ -98,7 +98,7 @@ static int mstdnt_attachment_json_callback(cJSON* json, void* _args)
return mstdnt_attachment_json(json, _args);
}
int mastodont_upload_media(mastodont_t* api,
int mstdnt_upload_media(mstdnt_t* api,
struct mstdnt_args* m_args,
struct mstdnt_upload_media_args* args,
struct mstdnt_storage* storage,
@ -109,7 +109,7 @@ int mastodont_upload_media(mastodont_t* api,
{ _MSTDNT_QUERY_FILE, "thumbnail", { .f = args->thumbnail } }
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/media",
NULL, 0,
@ -120,7 +120,7 @@ int mastodont_upload_media(mastodont_t* api,
mstdnt_attachment_json_callback,
};
return mastodont_request(api, m_args, &req_args);
return mstdnt_request(api, m_args, &req_args);
}
void mstdnt_cleanup_attachments(struct mstdnt_attachment* attachment)

View File

@ -104,7 +104,7 @@ static int mstdnt_messages_json_callback(cJSON* json, void* _args)
return mstdnt_messages_json(args->messages, args->messages_len, json);
}
int mastodont_get_chats_v2(mastodont_t* data,
int mstdnt_get_chats_v2(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_chats_args* args,
struct mstdnt_storage* storage,
@ -121,7 +121,7 @@ int mastodont_get_chats_v2(mastodont_t* data,
{ _MSTDNT_QUERY_INT, "offset", { .i = args->offset } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
.storage = storage,
.url = "api/v2/pleroma/chats",
.params_query = params,
@ -134,10 +134,10 @@ int mastodont_get_chats_v2(mastodont_t* data,
.callback = mstdnt_chats_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_get_chat_messages(mastodont_t* data,
int mstdnt_get_chat_messages(mstdnt_t* data,
struct mstdnt_args* m_args,
char* chat_id,
struct mstdnt_chats_args* args,
@ -158,7 +158,7 @@ int mastodont_get_chat_messages(mastodont_t* data,
{ _MSTDNT_QUERY_INT, "offset", { .i = args->offset } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
.storage = storage,
.url = url,
.params_query = params,
@ -171,10 +171,10 @@ int mastodont_get_chat_messages(mastodont_t* data,
.callback = mstdnt_messages_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_get_chat(mastodont_t* data,
int mstdnt_get_chat(mstdnt_t* data,
struct mstdnt_args* m_args,
char* chat_id,
struct mstdnt_storage* storage,
@ -183,7 +183,7 @@ int mastodont_get_chat(mastodont_t* data,
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, "api/v1/pleroma/chats/%s", chat_id);
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
.storage = storage,
.url = url,
.params_query = NULL,
@ -196,7 +196,7 @@ int mastodont_get_chat(mastodont_t* data,
.callback = mstdnt_chat_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
void mstdnt_cleanup_chat(struct mstdnt_chat* chat)

View File

@ -39,13 +39,13 @@ size_t mstdnt_curl_write_callback(char* ptr, size_t _size, size_t nmemb, void* _
return size;
}
void mastodont_fetch_results_cleanup(struct mstdnt_fetch_results* res)
void mstdnt_fetch_results_cleanup(struct mstdnt_fetch_results* res)
{
free(res->response);
}
#define TOKEN_STR_SIZE 512
int mastodont_fetch_curl(mastodont_t* mstdnt,
int mstdnt_fetch_curl(mstdnt_t* mstdnt,
CURL* curl,
struct mstdnt_args* m_args,
char* _url,

View File

@ -15,7 +15,7 @@
#include <mastodont_instance.h>
int mastodont_instance(mastodont_t* api, struct mstdnt_args* args,
int mstdnt_instance(mstdnt_t* api, struct mstdnt_args* args,
struct mstdnt_instance* inst)
{
return -1;

View File

@ -72,7 +72,7 @@ static int mstdnt_lists_json_callback(cJSON* json, void* _args)
return mstdnt_lists_json(args->lists, args->size, json);
}
int mastodont_get_lists(mastodont_t* data,
int mstdnt_get_lists(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_storage* storage,
struct mstdnt_list* lists[],
@ -83,7 +83,7 @@ int mastodont_get_lists(mastodont_t* data,
size
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/lists",
NULL, 0,
@ -94,10 +94,10 @@ int mastodont_get_lists(mastodont_t* data,
mstdnt_lists_json_callback
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_get_list(mastodont_t* data,
int mstdnt_get_list(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
@ -106,7 +106,7 @@ int mastodont_get_list(mastodont_t* data,
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, "api/v1/lists/%s", id);
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -117,7 +117,7 @@ int mastodont_get_list(mastodont_t* data,
mstdnt_list_json_callback
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
static const char* replies_policy_str(enum mstdnt_list_replies_policy pol)
@ -134,7 +134,7 @@ static const char* replies_policy_str(enum mstdnt_list_replies_policy pol)
}
}
int mastodont_create_list(mastodont_t* data, struct mstdnt_args* m_args,
int mstdnt_create_list(mstdnt_t* data, struct mstdnt_args* m_args,
struct mstdnt_list_args* args,
struct mstdnt_storage* storage,
struct mstdnt_list* list)
@ -144,7 +144,7 @@ int mastodont_create_list(mastodont_t* data, struct mstdnt_args* m_args,
{ _MSTDNT_QUERY_STRING, "replies_policy", { .s = (char*)replies_policy_str(args->replies_policy) } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/lists",
NULL, 0,
@ -155,10 +155,10 @@ int mastodont_create_list(mastodont_t* data, struct mstdnt_args* m_args,
mstdnt_list_json_callback
};
return mastodont_request(data, m_args,&req_args);
return mstdnt_request(data, m_args,&req_args);
}
int mastodont_update_list(mastodont_t* data,
int mstdnt_update_list(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_list_args* args,
@ -173,7 +173,7 @@ int mastodont_update_list(mastodont_t* data,
{ _MSTDNT_QUERY_STRING, "replies_policy", { .s = (char*)replies_policy_str(args->replies_policy) } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -184,10 +184,10 @@ int mastodont_update_list(mastodont_t* data,
mstdnt_list_json_callback
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_delete_list(mastodont_t* api,
int mstdnt_delete_list(mstdnt_t* api,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage)
@ -195,7 +195,7 @@ int mastodont_delete_list(mastodont_t* api,
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, "api/v1/lists/%s", id);
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -206,10 +206,10 @@ int mastodont_delete_list(mastodont_t* api,
NULL,
};
return mastodont_request(api, m_args, &req_args);
return mstdnt_request(api, m_args, &req_args);
}
int mastodont_list_add_accounts(mastodont_t* api,
int mstdnt_list_add_accounts(mstdnt_t* api,
struct mstdnt_args* m_args,
char* id,
char** account_ids,
@ -228,7 +228,7 @@ int mastodont_list_add_accounts(mastodont_t* api,
},
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -239,10 +239,10 @@ int mastodont_list_add_accounts(mastodont_t* api,
NULL,
};
return mastodont_request(api, m_args, &req_args);
return mstdnt_request(api, m_args, &req_args);
}
int mastodont_list_remove_accounts(mastodont_t* api,
int mstdnt_list_remove_accounts(mstdnt_t* api,
struct mstdnt_args* m_args,
char* id,
char** account_ids,
@ -261,7 +261,7 @@ int mastodont_list_remove_accounts(mastodont_t* api,
},
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -272,10 +272,10 @@ int mastodont_list_remove_accounts(mastodont_t* api,
NULL,
};
return mastodont_request(api, m_args, &req_args);
return mstdnt_request(api, m_args, &req_args);
}
int mastodont_list_get_accounts(mastodont_t* data,
int mstdnt_list_get_accounts(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_account_args* args,
@ -299,7 +299,7 @@ int mastodont_list_get_accounts(mastodont_t* data,
{ _MSTDNT_QUERY_INT, "with_relationships", { .i = args->with_relationships } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
params, _mstdnt_arr_len(params),
@ -310,7 +310,7 @@ int mastodont_list_get_accounts(mastodont_t* data,
mstdnt_accounts_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
void mstdnt_cleanup_lists(struct mstdnt_list* lists)

View File

@ -3,34 +3,34 @@
#include <mastodont.h>
#include <curl/curl.h>
void mastodont_global_curl_init()
void mstdnt_global_curl_init()
{
curl_global_init(CURL_GLOBAL_ALL);
}
void mastodont_global_curl_cleanup()
void mstdnt_global_curl_cleanup()
{
curl_global_cleanup();
}
// Curl multi can still be used with single context's
int mastodont_init(mastodont_t* data)
int mstdnt_init(mstdnt_t* data)
{
data->curl = curl_multi_init();
return data->curl == NULL;
}
void mastodont_cleanup(mastodont_t* data)
void mstdnt_cleanup(mstdnt_t* data)
{
curl_multi_cleanup(data->curl);
}
void mastodont_free(void* ptr)
void mstdnt_free(void* ptr)
{
free(ptr);
}
void mastodont_storage_cleanup(struct mstdnt_storage* storage)
void mstdnt_storage_cleanup(struct mstdnt_storage* storage)
{
if (storage->needs_cleanup)
{

View File

@ -94,7 +94,7 @@ int mstdnt_nodeinfo_json_callback(cJSON* json, void* nodeinfo)
return mstdnt_nodeinfo_json(nodeinfo, json);
}
int mastodont_get_nodeinfo(mastodont_t* api,
int mstdnt_get_nodeinfo(mstdnt_t* api,
struct mstdnt_args* m_args,
char* version,
struct mstdnt_storage* storage,
@ -103,7 +103,7 @@ int mastodont_get_nodeinfo(mastodont_t* api,
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, "nodeinfo/%s.json", version ? version : "2.1");
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -114,7 +114,7 @@ int mastodont_get_nodeinfo(mastodont_t* api,
mstdnt_nodeinfo_json_callback
};
return mastodont_request(api, m_args, &req_args);
return mstdnt_request(api, m_args, &req_args);
}
void mstdnt_cleanup_nodeinfo(struct mstdnt_nodeinfo* nodeinfo)

View File

@ -113,7 +113,7 @@ int mstdnt_notifications_json_callback(cJSON* json, void* _args)
return mstdnt_notifications_json(args->notif, args->size, json);
}
int mastodont_get_notifications(mastodont_t* data,
int mstdnt_get_notifications(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_notifications_args* args,
struct mstdnt_storage* storage,
@ -144,7 +144,7 @@ int mastodont_get_notifications(mastodont_t* data,
{ _MSTDNT_QUERY_INT, "limit", u_limit },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/notifications",
params, _mstdnt_arr_len(params),
@ -155,10 +155,10 @@ int mastodont_get_notifications(mastodont_t* data,
mstdnt_notifications_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_notification_dismiss(mastodont_t* data,
int mstdnt_notification_dismiss(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_storage* storage,
char* id)
@ -166,7 +166,7 @@ int mastodont_notification_dismiss(mastodont_t* data,
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, "api/v1/notifications/%s/dismiss", id);
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -177,14 +177,14 @@ int mastodont_notification_dismiss(mastodont_t* data,
NULL,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_notifications_clear(mastodont_t* data,
int mstdnt_notifications_clear(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_storage* storage)
{
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/notifications/clear",
NULL, 0,
@ -195,10 +195,10 @@ int mastodont_notifications_clear(mastodont_t* data,
NULL,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_notifications_read(mastodont_t* data,
int mstdnt_notifications_read(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_notifications_args* args,
struct mstdnt_storage* storage,
@ -209,7 +209,7 @@ int mastodont_notifications_read(mastodont_t* data,
{ _MSTDNT_QUERY_STRING, "max_id", { .s = args ? args->max_id : NULL } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/pleroma/notifications/read",
NULL, 0,
@ -220,7 +220,7 @@ int mastodont_notifications_read(mastodont_t* data,
mstdnt_notification_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}

View File

@ -20,7 +20,7 @@
#define CONV_SIZE 64
/* TODO audit this function for overflows */
char* _mstdnt_query_string(mastodont_t* data,
char* _mstdnt_query_string(mstdnt_t* data,
struct mstdnt_args* args,
char* src,
struct _mstdnt_query_param* params,

View File

@ -96,7 +96,7 @@ int mstdnt_relationships_json_callback(cJSON* json, void* _args)
return mstdnt_relationships_json(args->relationships, args->size, json);
}
int mastodont_get_relationships(mastodont_t* data, struct mstdnt_args* m_args,
int mstdnt_get_relationships(mstdnt_t* data, struct mstdnt_args* m_args,
char** ids,
size_t ids_len,
struct mstdnt_storage* storage,
@ -113,7 +113,7 @@ int mastodont_get_relationships(mastodont_t* data, struct mstdnt_args* m_args,
}
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/accounts/relationships",
params, _mstdnt_arr_len(params),
@ -124,7 +124,7 @@ int mastodont_get_relationships(mastodont_t* data, struct mstdnt_args* m_args,
mstdnt_relationships_json_callback
};
return mastodont_request(data, m_args,&req_args);
return mstdnt_request(data, m_args,&req_args);
}
void mstdnt_cleanup_relationships(struct mstdnt_relationship* rels)

View File

@ -70,9 +70,9 @@ static void mime_params_post(curl_mime* mime,
}
int mastodont_request(mastodont_t* data,
int mstdnt_request(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mastodont_request_args* args)
struct mstdnt_request_args* args)
{
int res = 0, curlerror = 0;
struct mstdnt_storage* storage = args->storage;
@ -113,7 +113,7 @@ int mastodont_request(mastodont_t* data,
else if (args->request_type == CURLOPT_POST)
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "");
curlerror = mastodont_fetch_curl(data,
curlerror = mstdnt_fetch_curl(data,
curl,
m_args,
url_query,
@ -147,7 +147,7 @@ int mastodont_request(mastodont_t* data,
res = 1;
cleanup_res:
mastodont_fetch_results_cleanup(&results);
mstdnt_fetch_results_cleanup(&results);
cleanup:
// Note: the fetch removed the handle from our multi handle
curl_easy_cleanup(curl);

View File

@ -52,7 +52,7 @@ int mstdnt_scrobbles_json_callback(cJSON* json, void* _args)
return mstdnt_scrobbles_json(args->scrobbles, args->size, json);
}
int mastodont_get_scrobbles(mastodont_t* data,
int mstdnt_get_scrobbles(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_get_scrobbles_args* args,
@ -72,7 +72,7 @@ int mastodont_get_scrobbles(mastodont_t* data,
{ _MSTDNT_QUERY_INT, "limit", { .i = args->limit } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
params, _mstdnt_arr_len(params),
@ -83,6 +83,6 @@ int mastodont_get_scrobbles(mastodont_t* data,
mstdnt_scrobbles_json_callback
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}

View File

@ -61,7 +61,7 @@ int mstdnt_search_json_callback(cJSON* json, void* _args)
return mstdnt_search_json(_args, json);
}
int mastodont_search(mastodont_t* data,
int mstdnt_search(mstdnt_t* data,
struct mstdnt_args* m_args,
char* query,
struct mstdnt_storage* storage,
@ -82,7 +82,7 @@ int mastodont_search(mastodont_t* data,
{ _MSTDNT_QUERY_INT, "offset", { .i = args->offset } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v2/search",
params, _mstdnt_arr_len(params),
@ -93,7 +93,7 @@ int mastodont_search(mastodont_t* data,
mstdnt_search_json_callback
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
void mstdnt_cleanup_search_results(struct mstdnt_search_results* res)

View File

@ -16,12 +16,12 @@
#include <mastodont_static.h>
#include <mastodont_fetch.h>
int mastodont_instance_panel(mastodont_t* api,
int mstdnt_instance_panel(mstdnt_t* api,
struct mstdnt_args* m_args,
struct mstdnt_fetch_results* html)
{
CURL* curl = curl_easy_init();
int status = mastodont_fetch_curl(api,
int status = mstdnt_fetch_curl(api,
curl,
m_args,
"instance/panel.html",
@ -32,12 +32,12 @@ int mastodont_instance_panel(mastodont_t* api,
return status;
}
int mastodont_terms_of_service(mastodont_t* api,
int mstdnt_terms_of_service(mstdnt_t* api,
struct mstdnt_args* m_args,
struct mstdnt_fetch_results* html)
{
CURL* curl = curl_easy_init();
int status = mastodont_fetch_curl(api,
int status = mstdnt_fetch_curl(api,
curl,
m_args,
"static/terms-of-service.html",

View File

@ -45,7 +45,7 @@ void _mstdnt_val_malloc_status_call(cJSON* v, void* _type)
mstdnt_status_json(*type, v->child);
}
// Consider moving to mastodont_visibility_types?
// Consider moving to mstdnt_visibility_types?
static void _mstdnt_val_visibility_call(cJSON* v, void* _type)
{
enum mstdnt_visibility_type* type = _type;
@ -144,7 +144,7 @@ int mstdnt_statuses_json_callback(cJSON* json, void* _args)
return mstdnt_statuses_json(args->statuses, args->size, json);
}
int mastodont_get_account_statuses(mastodont_t* data,
int mstdnt_get_account_statuses(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_account_statuses_args* args,
@ -170,7 +170,7 @@ int mastodont_get_account_statuses(mastodont_t* data,
{ _MSTDNT_QUERY_INT, "offset", { .i = args->offset } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
params, _mstdnt_arr_len(params),
@ -181,11 +181,11 @@ int mastodont_get_account_statuses(mastodont_t* data,
mstdnt_statuses_json_callback
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
/* TODO Populate the arguments! */
int mastodont_create_status(mastodont_t* data,
int mstdnt_create_status(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_status_args* args,
struct mstdnt_storage* storage)
@ -203,7 +203,7 @@ int mastodont_create_status(mastodont_t* data,
},
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/statuses",
NULL, 0,
@ -215,10 +215,10 @@ int mastodont_create_status(mastodont_t* data,
* (not sure if the api returns it or not) */
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
static int mstdnt_status_action(mastodont_t* data,
static int mstdnt_status_action(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
@ -228,7 +228,7 @@ static int mstdnt_status_action(mastodont_t* data,
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, url_str, id);
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -239,7 +239,7 @@ static int mstdnt_status_action(mastodont_t* data,
mstdnt_status_json_callback
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
/* These are all the same */
@ -273,7 +273,7 @@ MSTDNT_STATUS_ACTION_DECL(delete)
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, "api/v1/statuses/%s", id);
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -284,11 +284,11 @@ MSTDNT_STATUS_ACTION_DECL(delete)
mstdnt_status_json_callback
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
/* TODO Mutes can be timed */
int mastodont_mute_conversation(mastodont_t* data,
int mstdnt_mute_conversation(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
@ -297,7 +297,7 @@ int mastodont_mute_conversation(mastodont_t* data,
return mstdnt_status_action(data, m_args, id, storage, status, "api/v1/statuses/%s/mute");
}
int mastodont_unmute_conversation(mastodont_t* data,
int mstdnt_unmute_conversation(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
@ -306,7 +306,7 @@ int mastodont_unmute_conversation(mastodont_t* data,
return mstdnt_status_action(data, m_args, id, storage, status, "api/v1/statuses/%s/unmute");
}
int mastodont_get_status(mastodont_t* data,
int mstdnt_get_status(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
@ -315,7 +315,7 @@ int mastodont_get_status(mastodont_t* data,
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, "api/v1/statuses/%s", id);
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -326,7 +326,7 @@ int mastodont_get_status(mastodont_t* data,
mstdnt_status_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mstdnt_status_context_json(struct mstdnt_status* statuses_before[],
@ -388,7 +388,7 @@ int mstdnt_status_context_json_callback(cJSON* json, void* _args)
json);
}
int mastodont_get_status_context(mastodont_t* data,
int mstdnt_get_status_context(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
@ -406,7 +406,7 @@ int mastodont_get_status_context(mastodont_t* data,
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, "api/v1/statuses/%s/context", id);
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -417,10 +417,10 @@ int mastodont_get_status_context(mastodont_t* data,
mstdnt_status_context_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_status_favourited_by(mastodont_t* data,
int mstdnt_status_favourited_by(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
@ -434,7 +434,7 @@ int mastodont_status_favourited_by(mastodont_t* data,
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, "api/v1/statuses/%s/favourited_by", id);
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -445,10 +445,10 @@ int mastodont_status_favourited_by(mastodont_t* data,
mstdnt_accounts_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_status_reblogged_by(mastodont_t* data,
int mstdnt_status_reblogged_by(mstdnt_t* data,
struct mstdnt_args* m_args,
char* id,
struct mstdnt_storage* storage,
@ -462,7 +462,7 @@ int mastodont_status_reblogged_by(mastodont_t* data,
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, "api/v1/statuses/%s/reblogged_by", id);
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -473,11 +473,11 @@ int mastodont_status_reblogged_by(mastodont_t* data,
mstdnt_accounts_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_get_bookmarks(mastodont_t* data,
int mstdnt_get_bookmarks(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_bookmarks_args* args,
struct mstdnt_storage* storage,
@ -493,7 +493,7 @@ int mastodont_get_bookmarks(mastodont_t* data,
{ _MSTDNT_QUERY_INT, "limit", { .i = args->limit } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/bookmarks",
params, _mstdnt_arr_len(params),
@ -504,10 +504,10 @@ int mastodont_get_bookmarks(mastodont_t* data,
mstdnt_statuses_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_get_favourites(mastodont_t* data,
int mstdnt_get_favourites(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_favourites_args* args,
struct mstdnt_storage* storage,
@ -522,7 +522,7 @@ int mastodont_get_favourites(mastodont_t* data,
{ _MSTDNT_QUERY_INT, "limit", { .i = args->limit } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/favourites",
params, _mstdnt_arr_len(params),
@ -533,10 +533,10 @@ int mastodont_get_favourites(mastodont_t* data,
mstdnt_statuses_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_status_emoji_react(mastodont_t* api,
int mstdnt_status_emoji_react(mstdnt_t* api,
struct mstdnt_args* m_args,
char* id,
char* emoji,
@ -546,7 +546,7 @@ int mastodont_status_emoji_react(mastodont_t* api,
char url[MSTDNT_URLSIZE];
snprintf(url, MSTDNT_URLSIZE, "api/v1/pleroma/statuses/%s/reactions/%s", id, emoji);
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
NULL, 0,
@ -557,7 +557,7 @@ int mastodont_status_emoji_react(mastodont_t* api,
mstdnt_status_json_callback
};
return mastodont_request(api, m_args, &req_args);
return mstdnt_request(api, m_args, &req_args);
}
void mstdnt_cleanup_status(struct mstdnt_status* status)

View File

@ -20,7 +20,7 @@
#include <mastodont_query.h>
#include <mastodont_request.h>
int mastodont_timeline_list(mastodont_t* data,
int mstdnt_timeline_list(mstdnt_t* data,
struct mstdnt_args* m_args,
char* list_id,
struct mstdnt_timeline_args* args,
@ -45,7 +45,7 @@ int mastodont_timeline_list(mastodont_t* data,
{ _MSTDNT_QUERY_INT, "offset", { .i = args->offset } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
params, _mstdnt_arr_len(params),
@ -56,10 +56,10 @@ int mastodont_timeline_list(mastodont_t* data,
mstdnt_statuses_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_timeline_tag(mastodont_t* data,
int mstdnt_timeline_tag(mstdnt_t* data,
struct mstdnt_args* m_args,
char* hashtag,
struct mstdnt_timeline_args* args,
@ -87,7 +87,7 @@ int mastodont_timeline_tag(mastodont_t* data,
{ _MSTDNT_QUERY_BOOL, "with_muted", { .b = args->with_muted } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
url,
params, _mstdnt_arr_len(params),
@ -98,7 +98,7 @@ int mastodont_timeline_tag(mastodont_t* data,
mstdnt_statuses_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
static const char* reply_visibility_str(enum mstdnt_reply_visibility vis)
@ -115,7 +115,7 @@ static const char* reply_visibility_str(enum mstdnt_reply_visibility vis)
}
}
int mastodont_timeline_public(mastodont_t* data,
int mstdnt_timeline_public(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
@ -137,7 +137,7 @@ int mastodont_timeline_public(mastodont_t* data,
{ _MSTDNT_QUERY_INT, "limit", { .i = args->limit } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/timelines/public",
params, _mstdnt_arr_len(params),
@ -148,11 +148,11 @@ int mastodont_timeline_public(mastodont_t* data,
mstdnt_statuses_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_timeline_direct(mastodont_t* data,
int mstdnt_timeline_direct(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
@ -170,7 +170,7 @@ int mastodont_timeline_direct(mastodont_t* data,
{ _MSTDNT_QUERY_BOOL, "with_muted", { .b = args->with_muted } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/timelines/direct",
params, _mstdnt_arr_len(params),
@ -181,11 +181,11 @@ int mastodont_timeline_direct(mastodont_t* data,
mstdnt_statuses_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}
int mastodont_timeline_home(mastodont_t* data,
int mstdnt_timeline_home(mstdnt_t* data,
struct mstdnt_args* m_args,
struct mstdnt_timeline_args* args,
struct mstdnt_storage* storage,
@ -208,7 +208,7 @@ int mastodont_timeline_home(mastodont_t* data,
{ _MSTDNT_QUERY_INT, "offset", { .i = args->offset } },
};
struct mastodont_request_args req_args = {
struct mstdnt_request_args req_args = {
storage,
"api/v1/timelines/home",
params, _mstdnt_arr_len(params),
@ -219,6 +219,6 @@ int mastodont_timeline_home(mastodont_t* data,
mstdnt_statuses_json_callback,
};
return mastodont_request(data, m_args, &req_args);
return mstdnt_request(data, m_args, &req_args);
}

View File

@ -16,7 +16,7 @@
#include <mastodont_uri.h>
#include <string.h>
struct mstdnt_uri mastodont_uristr_to_uri(char* uri, size_t len)
struct mstdnt_uri mstdnt_uristr_to_uri(char* uri, size_t len)
{
int i;
struct mstdnt_uri ret;