Line | Count | Source (jump to first uncovered line) |
1 | | /** |
2 | | * @file |
3 | | * Pop-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 pop_edata Pop-specific Email data |
25 | | * |
26 | | * Pop-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 | | * pop_edata_free - Free the private Email data - Implements Email::edata_free() |
37 | | * |
38 | | * Each email has an attached PopEmailData, which contains things like the tags |
39 | | * (labels). |
40 | | */ |
41 | | void pop_edata_free(void **ptr) |
42 | 0 | { |
43 | 0 | if (!ptr || !*ptr) |
44 | 0 | return; |
45 | | |
46 | 0 | struct PopEmailData *edata = *ptr; |
47 | 0 | FREE(&edata->uid); |
48 | 0 | FREE(ptr); |
49 | 0 | } |
50 | | |
51 | | /** |
52 | | * pop_edata_new - Create a new PopEmailData for an email |
53 | | * @param uid Email UID |
54 | | * @retval ptr New PopEmailData struct |
55 | | */ |
56 | | struct PopEmailData *pop_edata_new(const char *uid) |
57 | 0 | { |
58 | 0 | struct PopEmailData *edata = mutt_mem_calloc(1, sizeof(struct PopEmailData)); |
59 | 0 | edata->uid = mutt_str_dup(uid); |
60 | 0 | return edata; |
61 | 0 | } |
62 | | |
63 | | /** |
64 | | * pop_edata_get - Get the private data for this Email |
65 | | * @param e Email |
66 | | * @retval ptr Private Email data |
67 | | */ |
68 | | struct PopEmailData *pop_edata_get(struct Email *e) |
69 | 0 | { |
70 | 0 | if (!e) |
71 | 0 | return NULL; |
72 | 0 | return e->edata; |
73 | 0 | } |