// email_management_system.h // Tammy Zhong // Header file for email management system functions // (Provided) // #defines #define MAX_LEN 100 #define HIGH_PRIORITY 1 #define NORMAL_PRIORITY 2 #define LOW_PRIORITY 3 // enum definition enum email_type { DRAFT, RECEIVED, SENT, }; // 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]; // assume unique double size; enum email_type type; int priority; // e.g. high priority = 1, normal = 2, low = 3 struct email *next; }; // Creates a new empty email folder // (TODO) struct folder *create_folder(char name[MAX_LEN]); // Add a new email to the folder at the head // (PROVIDED) struct folder *insert_email_at_head(struct folder *email_folder, char sender[MAX_LEN], char subject[MAX_LEN], double size, enum email_type type, int priority); // 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); // Returns number of emails in a given folder // (PROVIDED - TODO CAN BE IMPROVED) int count_emails(struct folder *email_folder); // Given a string, look for email where the subject is this string // (TODO) struct email *search_email(struct folder *email_folder, char subject[MAX_LEN]); // 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[MAX_LEN], struct folder *folder_1, struct folder *folder_2); // 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); // 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