Get single chat

FossilOrigin-Name: 11d28ba7876dec1e732d02559db31aa60fcb603eef462cbfa55786896c0efca2
This commit is contained in:
nekobit 2022-07-06 02:29:56 +00:00
parent d95ac33e25
commit 49fd32c3a7
2 changed files with 31 additions and 0 deletions

View file

@ -73,4 +73,10 @@ int mastodont_get_chat_messages(mastodont_t* data,
struct mstdnt_message* chats[],
size_t* size);
int mastodont_get_chat(mastodont_t* data,
struct mstdnt_args* m_args,
char* chat_id,
struct mstdnt_storage* storage,
struct mstdnt_chat chat);
#endif // MASTODONT_CHATS_H

View file

@ -172,3 +172,28 @@ int mastodont_get_chat_messages(mastodont_t* data,
return mastodont_request(data, m_args, &req_args);
}
int mastodont_get_chat(mastodont_t* data,
struct mstdnt_args* m_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);
struct mastodont_request_args req_args = {
.storage = storage,
.url = url,
.params_query = NULL,
.params_query_len = NULL,
.params_post = NULL,
.params_post_len = 0,
.request_type = CURLOPT_HTTPGET,
.request_type_custom = NULL,
.args = NULL,
.callback = mstdnt_chat_json_callback,
};
return mastodont_request(data, m_args, &req_args);
}