1 /* 2 * mbsync - mailbox synchronizer 3 * Copyright (C) 2000-2002 Michael R. Elkins <me@mutt.org> 4 * Copyright (C) 2002-2006,2010-2012 Oswald Buddenhagen <ossi@users.sf.net> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 * 19 * As a special exception, mbsync may be linked with the OpenSSL library, 20 * despite that library's more restrictive license. 21 */ 22 23 #ifndef SYNC_H 24 #define SYNC_H 25 26 #include "driver.h" 27 28 #define F 0 // far side 29 #define N 1 // near side 30 31 #define OP_NEW (1<<0) 32 #define OP_RENEW (1<<1) 33 #define OP_DELETE (1<<2) 34 #define OP_FLAGS (1<<3) 35 #define OP_MASK_TYPE (OP_NEW|OP_RENEW|OP_DELETE|OP_FLAGS) /* asserted in the target ops */ 36 #define OP_EXPUNGE (1<<4) 37 #define OP_CREATE (1<<5) 38 #define OP_REMOVE (1<<6) 39 #define XOP_PUSH (1<<8) 40 #define XOP_PULL (1<<9) 41 #define XOP_MASK_DIR (XOP_PUSH|XOP_PULL) 42 #define XOP_HAVE_TYPE (1<<10) 43 // The following must all have the same bit shift from the corresponding OP_* flags. 44 #define XOP_HAVE_EXPUNGE (1<<11) 45 #define XOP_HAVE_CREATE (1<<12) 46 #define XOP_HAVE_REMOVE (1<<13) 47 48 typedef struct channel_conf { 49 struct channel_conf *next; 50 const char *name; 51 store_conf_t *stores[2]; 52 const char *boxes[2]; 53 char *sync_state; 54 string_list_t *patterns; 55 int ops[2]; 56 int max_messages; // For near side only. 57 signed char expire_unread; 58 char use_internal_date; 59 } channel_conf_t; 60 61 typedef struct group_conf { 62 struct group_conf *next; 63 const char *name; 64 string_list_t *channels; 65 } group_conf_t; 66 67 extern channel_conf_t global_conf; 68 extern channel_conf_t *channels; 69 extern group_conf_t *groups; 70 71 extern const char *str_fn[2], *str_hl[2]; 72 73 #define SYNC_OK 0 /* assumed to be 0 */ 74 #define SYNC_FAIL 1 75 #define SYNC_BAD(fn) (4<<(fn)) 76 #define SYNC_NOGOOD 16 /* internal */ 77 #define SYNC_CANCELED 32 /* internal */ 78 79 #define BOX_POSSIBLE -1 80 #define BOX_ABSENT 0 81 #define BOX_PRESENT 1 82 83 /* All passed pointers must stay alive until cb is called. */ 84 void sync_boxes( store_t *ctx[], const char * const names[], int present[], channel_conf_t *chan, 85 void (*cb)( int sts, void *aux ), void *aux ); 86 87 #endif 88