1 /* 2 * libEtPan! -- a mail stuff library 3 * 4 * Copyright (C) 2001, 2002 - DINH Viet Hoa 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. Neither the name of the libEtPan! project nor the names of its 16 * contributors may be used to endorse or promote products derived 17 * from this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32 /* 33 * $Id$ 34 */ 35 36 #ifndef MAILMBOX_H 37 38 #define MAILMBOX_H 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 #include "mailmbox_types.h" 45 46 int 47 claws_mailmbox_append_message_list(struct claws_mailmbox_folder * folder, 48 carray * append_tab); 49 50 int 51 claws_mailmbox_append_message(struct claws_mailmbox_folder * folder, 52 const char * data, size_t len); 53 54 int claws_mailmbox_fetch_msg(struct claws_mailmbox_folder * folder, 55 uint32_t num, const char ** result, 56 size_t * result_len); 57 58 int claws_mailmbox_fetch_msg_headers(struct claws_mailmbox_folder * folder, 59 uint32_t num, const char ** result, 60 size_t * result_len); 61 62 void claws_mailmbox_fetch_result_free(char * msg); 63 64 int claws_mailmbox_copy_msg_list(struct claws_mailmbox_folder * dest_folder, 65 struct claws_mailmbox_folder * src_folder, 66 carray * tab); 67 68 int claws_mailmbox_copy_msg(struct claws_mailmbox_folder * dest_folder, 69 struct claws_mailmbox_folder * src_folder, 70 uint32_t uid); 71 72 int claws_mailmbox_expunge(struct claws_mailmbox_folder * folder); 73 74 int claws_mailmbox_delete_msg(struct claws_mailmbox_folder * folder, uint32_t uid); 75 76 int claws_mailmbox_init(const char * filename, 77 int force_readonly, 78 int force_no_uid, 79 uint32_t default_written_uid, 80 struct claws_mailmbox_folder ** result_folder); 81 82 void claws_mailmbox_done(struct claws_mailmbox_folder * folder); 83 84 /* low-level access primitives */ 85 86 int claws_mailmbox_write_lock(struct claws_mailmbox_folder * folder); 87 88 int claws_mailmbox_write_unlock(struct claws_mailmbox_folder * folder); 89 90 int claws_mailmbox_read_lock(struct claws_mailmbox_folder * folder); 91 92 int claws_mailmbox_read_unlock(struct claws_mailmbox_folder * folder); 93 94 95 /* memory map */ 96 97 int claws_mailmbox_map(struct claws_mailmbox_folder * folder); 98 99 void claws_mailmbox_unmap(struct claws_mailmbox_folder * folder); 100 101 void claws_mailmbox_sync(struct claws_mailmbox_folder * folder); 102 103 104 /* open & close file */ 105 106 int claws_mailmbox_open(struct claws_mailmbox_folder * folder); 107 108 void claws_mailmbox_close(struct claws_mailmbox_folder * folder); 109 110 111 /* validate cache */ 112 113 int claws_mailmbox_validate_write_lock(struct claws_mailmbox_folder * folder); 114 115 int claws_mailmbox_validate_read_lock(struct claws_mailmbox_folder * folder); 116 117 118 /* fetch message */ 119 120 int claws_mailmbox_fetch_msg_no_lock(struct claws_mailmbox_folder * folder, 121 uint32_t num, const char ** result, 122 size_t * result_len); 123 124 int claws_mailmbox_fetch_msg_headers_no_lock(struct claws_mailmbox_folder * folder, 125 uint32_t num, const char ** result, 126 size_t * result_len); 127 128 /* append message */ 129 130 int 131 claws_mailmbox_append_message_list_no_lock(struct claws_mailmbox_folder * folder, 132 carray * append_tab); 133 134 int claws_mailmbox_expunge_no_lock(struct claws_mailmbox_folder * folder); 135 136 #ifdef __cplusplus 137 } 138 #endif 139 140 #endif 141