mirror of
https://github.com/WCBROW01/zblock.git
synced 2025-12-11 20:18:07 -05:00
Extract feed_info struct and save routine to its own file
Also start creating basic framework for config
This commit is contained in:
44
feed_info.h
Normal file
44
feed_info.h
Normal file
@ -0,0 +1,44 @@
|
||||
#ifndef ZBLOCK_FEED_INFO_H
|
||||
#define ZBLOCK_FEED_INFO_H
|
||||
|
||||
#include <concord/discord.h>
|
||||
|
||||
// TODO: last_pubDate doesn't actually work properly yet
|
||||
typedef struct feed_info {
|
||||
char *title;
|
||||
char *url;
|
||||
char *last_pubDate;
|
||||
u64snowflake guild_id;
|
||||
u64snowflake channel_id;
|
||||
unsigned timer_id;
|
||||
unsigned feed_id;
|
||||
} feed_info;
|
||||
|
||||
typedef enum {
|
||||
FEED_INFO_OK,
|
||||
FEED_INFO_NULL,
|
||||
FEED_INFO_FILEERROR,
|
||||
FEED_INFO_ERRORCOUNT
|
||||
} feed_info_err;
|
||||
|
||||
/*
|
||||
* Free the feed info struct
|
||||
*/
|
||||
void feed_info_free(struct feed_info *feed);
|
||||
|
||||
/*
|
||||
* Get a string explaining a feed info error
|
||||
*/
|
||||
const char *feed_info_strerror(feed_info_err error);
|
||||
|
||||
/*
|
||||
* Saves feed info to given file
|
||||
*/
|
||||
feed_info_err feed_info_save_file(feed_info *feed);
|
||||
|
||||
/*
|
||||
* Reads feed info for given information from file and puts it in the provided struct
|
||||
*/
|
||||
feed_info_err feed_info_load_file(u64snowflake guild_id, u64snowflake channel_id, unsigned feed_id, feed_info *feed);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user