1 /* 2 * 3 4 Copyright (c) 2004-2012 NFG Net Facilities Group BV support@nfg.nl 5 6 This program is free software; you can redistribute it and/or 7 modify it under the terms of the GNU General Public License 8 as published by the Free Software Foundation; either 9 version 2 of the License, or (at your option) any later 10 version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 21 * 22 * 23 */ 24 25 /* 26 * 27 * \brief DbmailMailbox class 28 * 29 */ 30 31 #ifndef DM_MAILBOX_H 32 #define DM_MAILBOX_H 33 34 #include "dbmail.h" 35 #include "dm_mailboxstate.h" 36 37 typedef struct { 38 Mempool_T pool; 39 gboolean freepool; 40 41 uint64_t id; 42 uint64_t owner_id; 43 uint64_t size; 44 gboolean uid; 45 uint64_t modseq; 46 gboolean condstore; 47 gboolean qresync; 48 49 MailboxState_T mbstate; // cache mailbox metadata; 50 51 GList *sorted; // ordered list of UID values 52 GTree *found; // search result (key: uid, value: msn) 53 GNode *search; 54 const char *charset; // charset used during search/sort 55 56 } DbmailMailbox; 57 58 59 DbmailMailbox * dbmail_mailbox_new(Mempool_T, uint64_t); 60 int dbmail_mailbox_open(DbmailMailbox *self); 61 int dbmail_mailbox_sort(DbmailMailbox *self); 62 int dbmail_mailbox_search(DbmailMailbox *self); 63 64 GTree * dbmail_mailbox_get_msginfo(DbmailMailbox *self); 65 66 uint64_t dbmail_mailbox_get_id(DbmailMailbox *self); 67 68 void dbmail_mailbox_set_uid(DbmailMailbox *self, gboolean uid); 69 gboolean dbmail_mailbox_get_uid(DbmailMailbox *self); 70 71 int dbmail_mailbox_dump(DbmailMailbox *self, FILE *ostream); 72 73 void dbmail_mailbox_free(DbmailMailbox *self); 74 75 char * dbmail_mailbox_ids_as_string(DbmailMailbox *self, gboolean uid, const char *sep); 76 char * dbmail_mailbox_sorted_as_string(DbmailMailbox *self); 77 char * dbmail_mailbox_orderedsubject(DbmailMailbox *self); 78 79 int dbmail_mailbox_build_imap_search(DbmailMailbox *self, String_T *search_keys, uint64_t *idx, search_order order); 80 81 GTree * dbmail_mailbox_get_set(DbmailMailbox *self, const char *set, gboolean uid); 82 83 #endif 84