diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
commit | f7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch) | |
tree | a3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /src/replication/replication-common.h | |
parent | Initial commit. (diff) | |
download | dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.tar.xz dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.zip |
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/replication/replication-common.h')
-rw-r--r-- | src/replication/replication-common.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/replication/replication-common.h b/src/replication/replication-common.h new file mode 100644 index 0000000..77f711c --- /dev/null +++ b/src/replication/replication-common.h @@ -0,0 +1,48 @@ +#ifndef REPLICATION_COMMON_H +#define REPLICATION_COMMON_H + +enum replication_priority { + /* user is fully replicated, as far as we know */ + REPLICATION_PRIORITY_NONE = 0, + /* flag changes, expunges, etc. */ + REPLICATION_PRIORITY_LOW, + /* new emails */ + REPLICATION_PRIORITY_HIGH, + /* synchronously wait for new emails to be replicated */ + REPLICATION_PRIORITY_SYNC +}; + +static inline const char * +replicator_priority_to_str(enum replication_priority priority) +{ + switch (priority) { + case REPLICATION_PRIORITY_NONE: + return "none"; + case REPLICATION_PRIORITY_LOW: + return "low"; + case REPLICATION_PRIORITY_HIGH: + return "high"; + case REPLICATION_PRIORITY_SYNC: + return "sync"; + } + i_unreached(); +} + +static inline int +replication_priority_parse(const char *str, + enum replication_priority *priority_r) +{ + if (strcmp(str, "none") == 0) + *priority_r = REPLICATION_PRIORITY_NONE; + else if (strcmp(str, "low") == 0) + *priority_r = REPLICATION_PRIORITY_LOW; + else if (strcmp(str, "high") == 0) + *priority_r = REPLICATION_PRIORITY_HIGH; + else if (strcmp(str, "sync") == 0) + *priority_r = REPLICATION_PRIORITY_SYNC; + else + return -1; + return 0; +} + +#endif |