2022-06-16 10:44:35 +00:00
|
|
|
// SPDX-FileCopyrightText: 2000-2002 Michael R. Elkins <me@mutt.org>
|
|
|
|
// SPDX-FileCopyrightText: 2002-2022 Oswald Buddenhagen <ossi@users.sf.net>
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-isync-GPL-exception
|
2013-12-08 19:46:40 +00:00
|
|
|
/*
|
|
|
|
* mbsync - mailbox synchronizer
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SYNC_H
|
|
|
|
#define SYNC_H
|
|
|
|
|
|
|
|
#include "driver.h"
|
2022-05-31 12:05:28 +00:00
|
|
|
#include "sync_enum.h"
|
2013-12-08 19:46:40 +00:00
|
|
|
|
deprecate master/slave terminology
the underlying metaphor refers to an inhumane practice, so using it
casually is rightfully offensive to many people. it isn't even a
particularly apt metaphor, as it suggests a strict hierarchy that is
counter to mbsync's highly symmetrical mode of operation.
the far/near terminology has been chosen as the replacement, as it is a
natural fit for the push/pull terminology. on the downside, due to these
not being nouns, a few uses are a bit awkward, and several others had to
be amended to include 'side'. also, it's conceptually quite close to
remote/local, which matches the typical use case, but is maybe a bit too
suggestive of actually non-existing limitations.
the new f/n suffixes of the -C/-R/-X options clash with pre-existing
options, so direct concatenation of short options is even less practical
than before (some suffixes of -D already clashed), but doing that leads
to unreadable command lines anyway.
as with previous deprecations, all pre-existing command line and config
options keep working, but yield a warning. the state files are silently
upgraded.
2020-07-22 17:44:26 +00:00
|
|
|
#define F 0 // far side
|
|
|
|
#define N 1 // near side
|
2013-12-08 19:46:40 +00:00
|
|
|
|
2022-05-31 12:05:28 +00:00
|
|
|
BIT_ENUM(
|
|
|
|
OP_NEW,
|
|
|
|
OP_RENEW,
|
|
|
|
OP_DELETE,
|
|
|
|
OP_FLAGS,
|
|
|
|
OP_EXPUNGE,
|
|
|
|
OP_CREATE,
|
|
|
|
OP_REMOVE,
|
|
|
|
|
|
|
|
XOP_PUSH,
|
|
|
|
XOP_PULL,
|
|
|
|
XOP_HAVE_TYPE, // Aka mode; have at least one of dir and type (see below)
|
|
|
|
// The following must all have the same bit shift from the corresponding OP_* flags.
|
|
|
|
XOP_HAVE_EXPUNGE,
|
|
|
|
XOP_HAVE_CREATE,
|
|
|
|
XOP_HAVE_REMOVE,
|
2021-12-28 11:55:19 +00:00
|
|
|
// ... until here.
|
|
|
|
XOP_TYPE_NOOP,
|
|
|
|
// ... and here again from scratch.
|
|
|
|
XOP_EXPUNGE_NOOP,
|
|
|
|
XOP_CREATE_NOOP,
|
|
|
|
XOP_REMOVE_NOOP,
|
2022-05-31 12:05:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
#define OP_MASK_TYPE (OP_NEW | OP_RENEW | OP_DELETE | OP_FLAGS) // Asserted in the target side ops
|
|
|
|
#define XOP_MASK_DIR (XOP_PUSH | XOP_PULL)
|
2013-12-08 19:46:40 +00:00
|
|
|
|
2022-02-10 20:07:40 +00:00
|
|
|
DECL_BIT_FORMATTER_FUNCTION(ops, OP)
|
|
|
|
|
2013-12-08 19:46:40 +00:00
|
|
|
typedef struct channel_conf {
|
|
|
|
struct channel_conf *next;
|
|
|
|
const char *name;
|
|
|
|
store_conf_t *stores[2];
|
|
|
|
const char *boxes[2];
|
2022-05-30 21:04:52 +00:00
|
|
|
const char *sync_state;
|
2013-12-08 19:46:40 +00:00
|
|
|
string_list_t *patterns;
|
|
|
|
int ops[2];
|
deprecate master/slave terminology
the underlying metaphor refers to an inhumane practice, so using it
casually is rightfully offensive to many people. it isn't even a
particularly apt metaphor, as it suggests a strict hierarchy that is
counter to mbsync's highly symmetrical mode of operation.
the far/near terminology has been chosen as the replacement, as it is a
natural fit for the push/pull terminology. on the downside, due to these
not being nouns, a few uses are a bit awkward, and several others had to
be amended to include 'side'. also, it's conceptually quite close to
remote/local, which matches the typical use case, but is maybe a bit too
suggestive of actually non-existing limitations.
the new f/n suffixes of the -C/-R/-X options clash with pre-existing
options, so direct concatenation of short options is even less practical
than before (some suffixes of -D already clashed), but doing that leads
to unreadable command lines anyway.
as with previous deprecations, all pre-existing command line and config
options keep working, but yield a warning. the state files are silently
upgraded.
2020-07-22 17:44:26 +00:00
|
|
|
int max_messages; // For near side only.
|
2013-12-08 19:46:40 +00:00
|
|
|
signed char expire_unread;
|
|
|
|
char use_internal_date;
|
|
|
|
} channel_conf_t;
|
|
|
|
|
|
|
|
typedef struct group_conf {
|
|
|
|
struct group_conf *next;
|
|
|
|
const char *name;
|
|
|
|
string_list_t *channels;
|
|
|
|
} group_conf_t;
|
|
|
|
|
|
|
|
extern channel_conf_t global_conf;
|
|
|
|
extern channel_conf_t *channels;
|
|
|
|
extern group_conf_t *groups;
|
|
|
|
|
2022-04-24 12:30:10 +00:00
|
|
|
extern uint BufferLimit;
|
|
|
|
|
|
|
|
extern int new_total[2], new_done[2];
|
|
|
|
extern int flags_total[2], flags_done[2];
|
|
|
|
extern int trash_total[2], trash_done[2];
|
|
|
|
|
deprecate master/slave terminology
the underlying metaphor refers to an inhumane practice, so using it
casually is rightfully offensive to many people. it isn't even a
particularly apt metaphor, as it suggests a strict hierarchy that is
counter to mbsync's highly symmetrical mode of operation.
the far/near terminology has been chosen as the replacement, as it is a
natural fit for the push/pull terminology. on the downside, due to these
not being nouns, a few uses are a bit awkward, and several others had to
be amended to include 'side'. also, it's conceptually quite close to
remote/local, which matches the typical use case, but is maybe a bit too
suggestive of actually non-existing limitations.
the new f/n suffixes of the -C/-R/-X options clash with pre-existing
options, so direct concatenation of short options is even less practical
than before (some suffixes of -D already clashed), but doing that leads
to unreadable command lines anyway.
as with previous deprecations, all pre-existing command line and config
options keep working, but yield a warning. the state files are silently
upgraded.
2020-07-22 17:44:26 +00:00
|
|
|
extern const char *str_fn[2], *str_hl[2];
|
2013-12-08 19:46:40 +00:00
|
|
|
|
|
|
|
#define SYNC_OK 0 /* assumed to be 0 */
|
|
|
|
#define SYNC_FAIL 1
|
deprecate master/slave terminology
the underlying metaphor refers to an inhumane practice, so using it
casually is rightfully offensive to many people. it isn't even a
particularly apt metaphor, as it suggests a strict hierarchy that is
counter to mbsync's highly symmetrical mode of operation.
the far/near terminology has been chosen as the replacement, as it is a
natural fit for the push/pull terminology. on the downside, due to these
not being nouns, a few uses are a bit awkward, and several others had to
be amended to include 'side'. also, it's conceptually quite close to
remote/local, which matches the typical use case, but is maybe a bit too
suggestive of actually non-existing limitations.
the new f/n suffixes of the -C/-R/-X options clash with pre-existing
options, so direct concatenation of short options is even less practical
than before (some suffixes of -D already clashed), but doing that leads
to unreadable command lines anyway.
as with previous deprecations, all pre-existing command line and config
options keep working, but yield a warning. the state files are silently
upgraded.
2020-07-22 17:44:26 +00:00
|
|
|
#define SYNC_BAD(fn) (4<<(fn))
|
2013-12-08 19:46:40 +00:00
|
|
|
#define SYNC_NOGOOD 16 /* internal */
|
|
|
|
#define SYNC_CANCELED 32 /* internal */
|
|
|
|
|
2014-12-30 14:16:38 +00:00
|
|
|
#define BOX_POSSIBLE -1
|
|
|
|
#define BOX_ABSENT 0
|
|
|
|
#define BOX_PRESENT 1
|
|
|
|
|
2013-12-08 19:46:40 +00:00
|
|
|
/* All passed pointers must stay alive until cb is called. */
|
2019-07-28 19:13:28 +00:00
|
|
|
void sync_boxes( store_t *ctx[], const char * const names[], int present[], channel_conf_t *chan,
|
2013-12-08 19:46:40 +00:00
|
|
|
void (*cb)( int sts, void *aux ), void *aux );
|
|
|
|
|
|
|
|
#endif
|