1 /** 2 * @file 3 * Imap-specific Email data 4 * 5 * @authors 6 * Copyright (C) 2021 Richard Russon <rich@flatcap.org> 7 * 8 * @copyright 9 * This program is free software: you can redistribute it and/or modify it under 10 * the terms of the GNU General Public License as published by the Free Software 11 * Foundation, either version 2 of the License, or (at your option) any later 12 * version. 13 * 14 * This program is distributed in the hope that it will be useful, but WITHOUT 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 * details. 18 * 19 * You should have received a copy of the GNU General Public License along with 20 * this program. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 23 /** 24 * @page imap_edata Imap-specific Email data 25 * 26 * Imap-specific Email data 27 */ 28 29 #include "config.h" 30 #include <stddef.h> 31 #include "mutt/lib.h" 32 #include "email/lib.h" 33 #include "edata.h" 34 35 /** 36 * imap_edata_free - Free the private Email data - Implements Email::edata_free() 37 */ imap_edata_free(void ** ptr)38void imap_edata_free(void **ptr) 39 { 40 if (!ptr || !*ptr) 41 return; 42 43 struct ImapEmailData *edata = *ptr; 44 /* this should be safe even if the list wasn't used */ 45 FREE(&edata->flags_system); 46 FREE(&edata->flags_remote); 47 FREE(ptr); 48 } 49 50 /** 51 * imap_edata_new - Create a new ImapEmailData 52 * @retval ptr New ImapEmailData 53 */ imap_edata_new(void)54struct ImapEmailData *imap_edata_new(void) 55 { 56 return mutt_mem_calloc(1, sizeof(struct ImapEmailData)); 57 } 58 59 /** 60 * imap_edata_get - Get the private data for this Email 61 * @param e Email 62 * @retval ptr Private Email data 63 */ imap_edata_get(struct Email * e)64struct ImapEmailData *imap_edata_get(struct Email *e) 65 { 66 if (!e) 67 return NULL; 68 return e->edata; 69 } 70