sync.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. #ifndef SYNC_H
  23. #define SYNC_H
  24. #include "driver.h"
  25. #define M 0 /* master */
  26. #define S 1 /* slave */
  27. #define OP_NEW (1<<0)
  28. #define OP_RENEW (1<<1)
  29. #define OP_DELETE (1<<2)
  30. #define OP_FLAGS (1<<3)
  31. #define OP_MASK_TYPE (OP_NEW|OP_RENEW|OP_DELETE|OP_FLAGS) /* asserted in the target ops */
  32. #define OP_EXPUNGE (1<<4)
  33. #define OP_CREATE (1<<5)
  34. #define XOP_PUSH (1<<6)
  35. #define XOP_PULL (1<<7)
  36. #define XOP_MASK_DIR (XOP_PUSH|XOP_PULL)
  37. #define XOP_HAVE_TYPE (1<<8)
  38. #define XOP_HAVE_EXPUNGE (1<<9)
  39. #define XOP_HAVE_CREATE (1<<10)
  40. typedef struct channel_conf {
  41. struct channel_conf *next;
  42. const char *name;
  43. store_conf_t *stores[2];
  44. const char *boxes[2];
  45. char *sync_state;
  46. string_list_t *patterns;
  47. int ops[2];
  48. uint max_messages; /* for slave only */
  49. signed char expire_unread;
  50. char use_internal_date;
  51. } channel_conf_t;
  52. typedef struct group_conf {
  53. struct group_conf *next;
  54. const char *name;
  55. string_list_t *channels;
  56. } group_conf_t;
  57. extern channel_conf_t global_conf;
  58. extern channel_conf_t *channels;
  59. extern group_conf_t *groups;
  60. extern const char *str_ms[2], *str_hl[2];
  61. #define SYNC_OK 0 /* assumed to be 0 */
  62. #define SYNC_FAIL 1
  63. #define SYNC_FAIL_ALL 2
  64. #define SYNC_BAD(ms) (4<<(ms))
  65. #define SYNC_NOGOOD 16 /* internal */
  66. #define SYNC_CANCELED 32 /* internal */
  67. #define BOX_POSSIBLE -1
  68. #define BOX_ABSENT 0
  69. #define BOX_PRESENT 1
  70. /* All passed pointers must stay alive until cb is called. */
  71. void sync_boxes( store_t *ctx[], const char *names[], int present[], channel_conf_t *chan,
  72. void (*cb)( int sts, void *aux ), void *aux );
  73. #endif