You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
877 B
C
52 lines
877 B
C
#pragma once
|
|
|
|
#include "json/layout.h"
|
|
#include <stdbool.h>
|
|
#include <time.h>
|
|
|
|
struct emoji;
|
|
struct account;
|
|
struct status;
|
|
|
|
struct status_poll_option
|
|
{
|
|
char* title;
|
|
|
|
struct {
|
|
int* items;
|
|
int count;
|
|
} votes;
|
|
};
|
|
|
|
struct status_poll
|
|
{
|
|
int id;
|
|
time_t expires_at;
|
|
bool multiple_choice;
|
|
int votes_count;
|
|
bool voted;
|
|
|
|
struct {
|
|
int* items;
|
|
int count;
|
|
} own_votes;
|
|
|
|
struct {
|
|
struct status_poll_option** items;
|
|
int count;
|
|
} options;
|
|
|
|
struct {
|
|
struct emoji** items;
|
|
int count;
|
|
} emoji;
|
|
};
|
|
|
|
extern struct json_field_type status_poll_type;
|
|
void status_poll_option_free( struct status_poll_option* o );
|
|
void status_poll_free( struct status_poll* p );
|
|
bool status_poll_has_option( struct status_poll* p, int idx );
|
|
bool status_poll_add_vote( struct status* s, struct account* a, void* choices );
|
|
void status_poll_update_vote_count( struct status_poll* poll );
|
|
|