Loop
FossilOrigin-Name: 1929800c5a59d2689307cbfa8362cdcb9aeb228eba06da6801fa65ed3d4e71d6
This commit is contained in:
parent
7606545a27
commit
53461b6fc3
1 changed files with 31 additions and 2 deletions
|
@ -22,9 +22,29 @@ char* get_line(char const* prompt)
|
|||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
tl_callback(mstdnt_request_cb_data* cb_data, void* args)
|
||||
{
|
||||
struct mstdnt_statuses* statuses = MSTDNT_CB_DATA(cb_data);
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < statuses->len+2; ++i)
|
||||
{
|
||||
struct mstdnt_status* status = statuses->statuses + i;
|
||||
puts("---------------- BEGIN STATUS ----------------");
|
||||
printf(" Author: %s", status->account.username);
|
||||
puts("----------------- END STATUS -----------------");
|
||||
}
|
||||
|
||||
return MSTDNT_REQUEST_DONE;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
mstdnt_global_curl_init();
|
||||
|
||||
mastodont_t data;
|
||||
|
@ -32,14 +52,23 @@ main(int argc, char** argv)
|
|||
if (mstdnt_init(&data) != 0)
|
||||
{
|
||||
fputs("Couldn't initialize Mastodont-c!", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char* instance = get_line("Instance");
|
||||
|
||||
puts(instance);
|
||||
struct mstdnt_args m_args = {
|
||||
.url = instance,
|
||||
.token = NULL,
|
||||
.flags = 0,
|
||||
};
|
||||
|
||||
mstdnt_timeline_public(&data, &m_args, tl_callback, NULL, (struct mstdnt_timeline_args){});
|
||||
|
||||
mstdnt_await(&data, 0, NULL, 0);
|
||||
|
||||
// Cleanup
|
||||
free(instance);
|
||||
|
||||
mstdnt_cleanup(&data);
|
||||
mstdnt_global_curl_cleanup();
|
||||
|
||||
|
|
Loading…
Reference in a new issue