stamail.h (2860B)
1 /* 2 * ============================================================================ 3 * ███████╗████████╗ █████╗ ███╗ ███╗ █████╗ ██╗██╗ 4 * ██╔════╝╚══██╔══╝██╔══██╗████╗ ████║██╔══██╗██║██║ 5 * ███████╗ ██║ ███████║██╔████╔██║███████║██║██║ 6 * ╚════██║ ██║ ██╔══██║██║╚██╔╝██║██╔══██║██║██║ 7 * ███████║ ██║ ██║ ██║██║ ╚═╝ ██║██║ ██║██║███████╗ 8 * ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚══════╝ 9 * ============================================================================ 10 * 11 * Copyright (C) 2026 Binkd. 12 * 13 * This file is part of stamail. 14 * 15 * stamail is free software: you can redistribute it and/or modify it under the 16 * terms of the GNU General Public License as published by the Free Software 17 * Foundation, either version 3 of the License, or (at your option) any later 18 * version. 19 * 20 * stamail is distributed in the hope that it will be useful, but WITHOUT ANY 21 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 22 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 23 * details. 24 * 25 * You should have received a copy of the GNU General Public License 26 * along with stamail. If not, see <https://www.gnu.org/licenses/>. 27 * 28 * ============================================================================= 29 */ 30 31 #ifndef STAMAIL_H 32 #define STAMAIL_H 33 34 #include <time.h> 35 36 37 /* Thread Root */ 38 struct thread { 39 struct thread_node *root; 40 char *subject; 41 time_t latest; 42 int message_count; 43 }; 44 45 struct message { 46 const char *id; int id_len; 47 const char *from; int from_len; 48 const char *subject;int subject_len; 49 const char *date; int date_len; 50 const char *body; int body_len; 51 52 /* Threading fields */ 53 const char *in_reply_to; 54 int in_reply_to_len; 55 const char *references; 56 int references_len; 57 58 const char *filename; 59 int filename_len; 60 61 time_t timestamp; 62 }; 63 64 struct message_node { 65 struct message m; 66 struct message_node *next; 67 }; 68 69 /* Thread tree node */ 70 struct thread_node { 71 struct message *msg; 72 73 struct thread_node *parent; 74 struct thread_node *child; 75 struct thread_node *sibling; 76 77 int depth; 78 int num_children; 79 }; 80 81 82 /* Called for every message found */ 83 typedef void (*message_cb)(struct message *m, void *userdata); 84 void walk(struct sexp *n); 85 86 #endif