2019-07-04 20:58:08 +02:00
|
|
|
#ifndef DC_CHANNEL_H
|
|
|
|
#define DC_CHANNEL_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <jansson.h>
|
|
|
|
|
2019-07-05 16:40:16 +02:00
|
|
|
#include <dc/account.h>
|
2019-07-08 18:38:24 +02:00
|
|
|
#include <dc/message.h>
|
2019-07-05 16:40:16 +02:00
|
|
|
|
2019-07-04 20:58:08 +02:00
|
|
|
/**
|
|
|
|
* A discord channel. Exactly what it says on the tin. A place where one
|
|
|
|
* or more guardsmen can exchange Slaaneshi heresy without their commissars
|
|
|
|
* finding out about it. What's important here is that there are channel
|
|
|
|
* types, and that each channel has various recipients.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
/* standard text channel in a guild
|
|
|
|
*/
|
|
|
|
CHANNEL_TYPE_GUILD_TEXT = 0,
|
|
|
|
|
|
|
|
/* A direct message channel for 1:1 communication
|
|
|
|
*/
|
|
|
|
CHANNEL_TYPE_DM_TEXT,
|
|
|
|
|
|
|
|
/* A guild voice channel
|
|
|
|
*/
|
|
|
|
CHANNEL_TYPE_GUILD_VOICE,
|
|
|
|
|
|
|
|
/* Group direct message channel 1:N communication
|
|
|
|
*/
|
|
|
|
CHANNEL_TYPE_GROUP_DM,
|
|
|
|
|
|
|
|
/* Category within a GUILD
|
|
|
|
*/
|
|
|
|
CHANNEL_TYPE_GUILD_CATEGORY,
|
|
|
|
|
|
|
|
/* News channel
|
|
|
|
*/
|
|
|
|
CHANNEL_TYPE_GUILD_NEWS,
|
|
|
|
|
|
|
|
/* Guild store, no idea what this is
|
|
|
|
*/
|
|
|
|
CHANNEL_TYPE_GUILD_STORE,
|
|
|
|
} dc_channel_type_t;
|
|
|
|
|
|
|
|
struct dc_channel_;
|
|
|
|
typedef struct dc_channel_ *dc_channel_t;
|
|
|
|
|
|
|
|
dc_channel_t dc_channel_new(void);
|
|
|
|
dc_channel_t dc_channel_from_json(json_t *j);
|
|
|
|
|
2019-07-08 18:38:24 +02:00
|
|
|
char const *dc_channel_id(dc_channel_t c);
|
|
|
|
|
2019-07-04 20:58:08 +02:00
|
|
|
dc_channel_type_t dc_channel_type(dc_channel_t c);
|
|
|
|
void dc_channel_set_type(dc_channel_t c, dc_channel_type_t t);
|
|
|
|
|
2019-07-05 16:40:16 +02:00
|
|
|
size_t dc_channel_recipients(dc_channel_t c);
|
2019-07-10 20:16:47 +02:00
|
|
|
void dc_channel_add_recipient(dc_channel_t c, dc_account_t a);
|
|
|
|
dc_account_t dc_channel_nth_recipient(dc_channel_t c, size_t i);
|
|
|
|
bool dc_channel_has_recipient(dc_channel_t c, dc_account_t a);
|
2019-07-05 16:40:16 +02:00
|
|
|
|
2019-07-08 18:38:24 +02:00
|
|
|
size_t dc_channel_messages(dc_channel_t c);
|
2019-07-10 20:16:47 +02:00
|
|
|
dc_message_t dc_channel_nth_message(dc_channel_t c, size_t i);
|
|
|
|
void dc_channel_add_messages(dc_channel_t c, dc_message_t *m, size_t s);
|
|
|
|
|
|
|
|
bool dc_channel_compare(dc_channel_t a, dc_channel_t b);
|
2019-07-08 18:38:24 +02:00
|
|
|
|
2019-07-04 20:58:08 +02:00
|
|
|
#endif
|