// email_management_system.h // Tammy Zhong // Header file for email management system functions // Modified by Angela Finlayson // (Provided) // #defines #define MAX_LEN 100 // enum definition enum email_type { DRAFT, RECEIVED, SENT, }; enum priority_type { LOW_PRIORITY, NORMAL_PRIORITY, HIGH_PRIORITY }; // struct definitions struct folder { char name[MAX_LEN]; //int num_emails; // to use later :) struct email *emails; }; struct email { char sender[MAX_LEN]; char subject[MAX_LEN]; double size; enum email_type type; enum priority_type priority; struct email *next; }; // Creates a new empty email folder // (TODO) struct folder *create_folder(char name[]); // Add a new email to the folder at the head // (TODO) void insert_email_at_head(struct folder *email_folder, char sender[], char subject[], double size, enum email_type type, int priority); // Given a string, look for email where the subject is this string // (TODO) struct email *search_email(struct folder *email_folder, char subject[]); // Remove email(s) with certain priority (e.g. filter out low priority emails) // (TODO) void delete_email_of_priority(struct folder *email_folder, int priority); // Append emails from folder_2 after folder_1 and returns them in the one folder // (TODO) struct folder *merge_folders(char merged_folder_name[], struct folder *folder_1, struct folder *folder_2); // Split emails in a given folder into 3 folders based on email type // keeping original ordering // (TODO) void split_folder(struct folder *given_folder, struct folder *inbox, struct folder *sent, struct folder *draft); // Removes all emails from a folder // (TODO) void clear_folder(struct folder *email_folder); // leak-check demo // Returns number of emails in a given folder // (PROVIDED - TODO CAN BE IMPROVED) int count_emails(struct folder *email_folder); // CHALLENGE at home for fun: Sort emails in folder based on size // (slightly out of scope of COMP1511 - touches on sorting algorithms) // (TODO) void sort_emails(struct folder *email_folder); // Prints out details of a single email // (PROVIDED) void print_single_email(struct email *email); // Print/display all emails in folder // (PROVIDED) void print_emails(struct folder *email_folder);